-
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
Connection Instability with socketTimeout
Parameter
#1919
Labels
Comments
The actual error:
|
bobymicroby
added a commit
to bobymicroby/ioredis
that referenced
this issue
Dec 20, 2024
…#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
added a commit
to bobymicroby/ioredis
that referenced
this issue
Dec 20, 2024
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
🎉 This issue has been resolved in version 5.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@pinkiesky Thanks for opening this issue and submitting the fix! Your contribution is much appreciated! |
alexandresoro
pushed a commit
to alexandresoro/ouca-backend
that referenced
this issue
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 <[email protected]> Co-authored-by: renovate <[email protected]> Co-committed-by: renovate <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When setting the socketTimeout parameter to a non-zero value, the Redis connection becomes unstable after startup. The connection repeatedly closes due to the socketTimeout mechanism, reconnects, and then falls into a loop of closing and reconnecting.
Code for the bug reproduction
Here’s a typical log output from running the code:
In this example, the connection eventually stabilized after 10 reconnection attempts, but the number of attempts seems random and can vary between runs. My tests often have 2-3 reconnections, but this may differ for others.
My environment:
The text was updated successfully, but these errors were encountered: