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

Introduce post-connection timeout setting #531

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hardcodet
Copy link

@hardcodet hardcodet commented Jul 23, 2019

Currently, the timeout for the underlying socket is reset to 0 after a successful connection. This can lead to promises hanging indefinitely / callbacks not being invoked in case the server becomes unresponsive. On the other hand, just using the default socket timeout may be too short, and introduce runtime errors.

As a solution, this change introduces a second socket option postConnectTimeout which is being applied to the socket after a successful connection, rather than resetting the timeout to 0. If the setting is not provided, a high default timeout of 300000 (5 minutes) is being set, which would still prevent indefinitely blocking clients.

Currently, the timeout for the underlying socket is reset to `0` after a successful connection. This can lead to promises hanging indefinitely / callback not being invoked in case the server become unresponsive. On the other hand, just using the connection timeout may be too short, and introduce runtime errors.

As a solution, introduce a second socket option `postConnectTimeout` which is being applied to the socket rather than resetting the timeout to `0`. If the setting is not provided, a high default timeout of 300000 (5 minutes) is being set, which would still prevent indefinitely blocking clients.
Base automatically changed from master to main February 17, 2021 22:01
@cressie176
Copy link
Collaborator

This looks like a good idea to me, although I think unnecessary if heartbeats or TCP Keep Alive is enabled. Since heartbeats are enabled by default, I would change the default post-connection timeout to 0, but still support it as an option. Thoughts @hardcodet, @kibertoad?

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

Successfully merging this pull request may close these issues.

2 participants