-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add TCP keep-alive? #547
Comments
I looked into this recently in another project, and found that Rust std I haven't studied hyper in detail, if they have more reasons that keepalive to use |
Or in other words: This is the first time anyone raised the issue about |
By the way, my experience of this category of problem is that it is often caused by a firewall that silently drops idle TCP connections (that is, without sending a RST). For clients that keep a connection pool, the connection appears to be open and the next request is sent on it. From the firewall's perspective, it receives a TCP segment for a connection that does not exist, and drops it. The client winds up waiting for a response that will never come. Depending on the OS settings it might wait 30 minutes to an hour before it gets an error. TCP keepalive is one way to work around this problem. Some others to try for the short term (of course, these have their drawbacks):
|
I'd be interested to see this too. I'm unsure if this helps with my use case though. |
Interested in this too, to handle a firewall that kills idle connections: Nitrokey/nethsm-pkcs11#164 |
We should be on the lookout for lightweight crates that solve this problem. Add it under a feature flag. |
I'm currently working through what to do about a codebase that uses
ureq
and is suffering from what looks like a very occasionally unresponsive server. I'd like to toggle on TCP keepalive to see if that fixes the problem, but currently there is no API for this.reqwest
has this: https://docs.rs/reqwest/0.11.12/reqwest/blocking/struct.ClientBuilder.html#method.tcp_keepalive and the implementation which is in the middle of being migrated tohyper-util
looks pretty simple: https://github.com/hyperium/hyper-util/blob/85aade41a080fc4b40a9a53c818680feed14f138/src/client/connect/http.rs#L593-L598Are you interested in accepting a PR which adds this feature?
The text was updated successfully, but these errors were encountered: