Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Connection instability when using socketTimeout parameter #1937

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

bobymicroby
Copy link
Member

The issue occurs when using socketTimeout, causing connections to become unstable with repeated disconnections and reconnections. This happens due to incorrect ordering of socket stream event handling.

Changes:

  • Use prependListener() instead of on() for DataHandler stream data events
  • Explicitly call resume() after attaching the DataHandler stream listener
  • Add tests to verify socket timeout behavior

This ensures the parser receives and processes data before timeout checks, preventing premature timeouts and connection instability.

Fixes #1919

The issue occurs when using socketTimeout, causing connections to become
unstable with repeated disconnections and reconnections. This happens due
to incorrect ordering of socket stream event handling.

Changes:
- Use prependListener() instead of on() for `DataHandler` stream data events
- Explicitly call resume() after attaching the `DataHandler` stream listener
- Add tests to verify socket timeout behavior

This ensures the parser receives and processes data before timeout checks,
preventing premature timeouts and connection instability.

Fixes redis#1919
@bobymicroby bobymicroby changed the title fix: Connection instability when using socketTimeout parameter (#1919) fix: Connection instability when using socketTimeout parameter Dec 20, 2024
Copy link

@tishun tishun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bobymicroby bobymicroby merged commit ca5e940 into redis:main Dec 20, 2024
5 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 20, 2024
## [5.4.2](v5.4.1...v5.4.2) (2024-12-20)

### Bug Fixes

* Connection instability when using socketTimeout parameter ([#1937](#1937)) ([ca5e940](ca5e940)), closes [#1919](#1919)
Copy link

🎉 This PR is included in version 5.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection Instability with socketTimeout Parameter
2 participants