Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TCP_USER_TIMEOUT
is a quite powerful tool for managing TCP timeouts. It is a bit complex in how it behaves but it is currently the only real way for controlling the number of retransmits an active socket makes before giving up and timing out. Without this parameter set on the socket, we fallback to the OS defaulttcp_retries2
parameter which generally keeps retrying for about 15 minutes before declaring the connection dead.using
TCP_USER_TIMEOUT
with keepalive parameter ensures that we detect bad connections early and clean them up before we exhaust our pools and lock up the proxy.Docs:
https://man7.org/linux/man-pages/man7/tcp.7.html
https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/
https://tech.instacart.com/the-vanishing-thread-and-postgresql-tcp-connection-parameters-93afc0e1208c