Repository navigation
redis: configurable TCP keepalive and TCP_USER_TIMEOUT - #1285
Merged
Merged
Conversation
radix v4 hard-codes a 10s TCP keepalive on the connections it dials, and nothing sets TCP_USER_TIMEOUT. Keepalive probes are only sent on idle connections, so they cannot detect a dead peer while there is unacknowledged data in flight, which is exactly the state of a busy connection to a Redis server that vanished. The kernel then only closes it after net.ipv4.tcp_retries2 retransmissions, about 15 minutes by default. Add REDIS_TCP_USER_TIMEOUT / REDIS_PERSECOND_TCP_USER_TIMEOUT (Linux only, off by default) to bound how long sent data may stay unacknowledged, and REDIS_TCP_KEEPALIVE / REDIS_PERSECOND_TCP_KEEPALIVE (default 10s, as radix did; negative disables it). These complement the I/O timeout: TCP_USER_TIMEOUT catches a peer that stopped acknowledging, the I/O timeout catches one that acknowledges but never replies. golang.org/x/sys becomes a direct dependency. Also restore the "Connection Timeout" README intro, which envoyproxy#1272 reverted to "connection establishment" only while REDIS_TIMEOUT also bounds reads and writes since envoyproxy#1271. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Ignasi Barrera <ignasi@tetrate.io>
psbrar99
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
radix v4 hard-codes a 10s TCP keepalive on the connections it dials, and nothing sets TCP_USER_TIMEOUT. Keepalive probes are only sent on idle connections, so they cannot detect a dead peer while there is unacknowledged data in flight, which is exactly the state of a busy connection to a Redis server that vanished. The kernel then only closes it after net.ipv4.tcp_retries2 retransmissions, about 15 minutes by default.
Add REDIS_TCP_USER_TIMEOUT / REDIS_PERSECOND_TCP_USER_TIMEOUT (Linux only, off by default) to bound how long sent data may stay unacknowledged, and REDIS_TCP_KEEPALIVE / REDIS_PERSECOND_TCP_KEEPALIVE (default 10s, as radix did; negative disables it). These complement the I/O timeout: TCP_USER_TIMEOUT catches a peer that stopped acknowledging, the I/O timeout catches one that acknowledges but never replies.