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.
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.