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

Force disconnect after a timeout if socket is still half-open #1318

Merged
merged 2 commits into from
Mar 31, 2021

Conversation

mjomble
Copy link
Contributor

@mjomble mjomble commented Mar 31, 2021

As discussed on #1314, if the Redis server is made unreachable with the DEBUG SLEEP command or docker pause, the connection hangs in such a way that socket.end() can leave it indefinitely in a half-closed state, which doesn't trigger a reconnect.

This PR fixes it so that if the socket doesn't fully close in 2 seconds (configurable via the new disconnectTimeout option), it is destroyed.

@luin luin self-requested a review March 31, 2021 15:08
@luin luin merged commit 6cacd17 into redis:master Mar 31, 2021
ioredis-robot pushed a commit that referenced this pull request Mar 31, 2021
## [4.24.6](v4.24.5...v4.24.6) (2021-03-31)

### Bug Fixes

* force disconnect after a timeout if socket is still half-open ([#1318](#1318)) ([6cacd17](6cacd17))
@ioredis-robot
Copy link
Collaborator

🎉 This PR is included in version 4.24.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mjomble mjomble deleted the disconnect-timeout branch April 1, 2021 05:18
janus-dev87 added a commit to janus-dev87/ioredis-work that referenced this pull request Mar 1, 2024
## [4.24.6](redis/ioredis@v4.24.5...v4.24.6) (2021-03-31)

### Bug Fixes

* force disconnect after a timeout if socket is still half-open ([#1318](redis/ioredis#1318)) ([6cacd17](redis/ioredis@6cacd17))
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.

3 participants