-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
1e6e080
to
78ece6b
Compare
tishun
approved these changes
Dec 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 This PR is included in version 5.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
alexandresoro
pushed a commit
to alexandresoro/ouca-backend
that referenced
this pull request
Feb 8, 2025
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ioredis](https://github.com/luin/ioredis) | dependencies | minor | [`5.4.2` -> `5.5.0`](https://renovatebot.com/diffs/npm/ioredis/5.4.2/5.5.0) | --- ### Release Notes <details> <summary>luin/ioredis (ioredis)</summary> ### [`v5.5.0`](https://github.com/luin/ioredis/blob/HEAD/CHANGELOG.md#550-2025-02-07) [Compare Source](redis/ioredis@v5.4.2...v5.5.0) ##### Features - Add ability for nat mapping through function ([#​1948](redis/ioredis#1948)) ([3a04bee](redis/ioredis@3a04bee)) - **HscanStream:** adding NOVALUES option ([#​1943](redis/ioredis#1943)) ([2f9843d](redis/ioredis@2f9843d)) #### [5.4.2](redis/ioredis@v5.4.1...v5.4.2) (2024-12-20) ##### Bug Fixes - Connection instability when using socketTimeout parameter ([#​1937](redis/ioredis#1937)) ([ca5e940](redis/ioredis@ca5e940)), closes [#​1919](redis/ioredis#1919) #### [5.4.1](redis/ioredis@v5.4.0...v5.4.1) (2024-04-17) ##### Bug Fixes - remove console.log ([558497c](redis/ioredis@558497c)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjMuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE2My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> Reviewed-on: https://git.tristess.app/alexandresoro/ouca-backend/pulls/538 Reviewed-by: Alexandre Soro <code@soro.dev> Co-authored-by: renovate <renovate@git.tristess.app> Co-committed-by: renovate <renovate@git.tristess.app>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
DataHandler
stream data eventsDataHandler
stream listenerThis ensures the parser receives and processes data before timeout checks, preventing premature timeouts and connection instability.
Fixes #1919