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

Expose as fd + opts can set tcp_user_timeout #307

Merged
merged 3 commits into from
Jan 24, 2022

Conversation

fulara
Copy link
Contributor

@fulara fulara commented Jan 19, 2022

TCP timeouts are hard.

I have observed that in one specific scenario, namely when target endpoint goes down in aws land, application connecting to db hangs for around 15 minutes, even with setting the connect_timeout, I don't want to set read_timeout as that may have undesirable effect on long executing queries

Now, my knowledge in tcp is very accidental, but the TCP_USER_TIMEOUT seems to achieve the desired behavior.

I have added 2 commits:

  1. impl as_raw_fd(), this way I could have modified the user_timeout without having to hack the library
  2. Since I am here, add support in Opts to handle tcp_user_timeout via ops.

I have not tested whether this builds on non linux platform.

This may be useful in case clients want to set some exoteric socket
options on the underlying socket.
@blackbeam blackbeam merged commit e63eb3f into blackbeam:master Jan 24, 2022
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