Enable SO_KEEPALIVE and SO_LINGER on JRT TCP connections#36060
Open
papa99do wants to merge 2 commits intovespa-engine:masterfrom
Open
Enable SO_KEEPALIVE and SO_LINGER on JRT TCP connections#36060papa99do wants to merge 2 commits intovespa-engine:masterfrom
papa99do wants to merge 2 commits intovespa-engine:masterfrom
Conversation
Enable TCP keepalive probes and linger-on-close for JRT connections to improve detection and cleanup of dead peers during rolling upgrades. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
papa99do
commented
Feb 28, 2026
| return ((socket != null) && (socket.channel() != null)); | ||
| } | ||
|
|
||
| SocketChannel socketChannel() { |
Contributor
Author
There was a problem hiding this comment.
visible for unit tests
3 tasks
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.
Summary
SO_KEEPALIVEon JRT TCP connections for dead peer detection via OS-level keepalive probesSO_LINGERwith timeout 0 for immediate connection teardown (RST instead of TIME_WAIT) when closing stale connectionsThese options help detect and clean up stale TCP connections faster, particularly useful during rolling upgrades when config servers restart and existing connections may become half-open.
Changes
Single file change in
jrt/src/com/yahoo/jrt/Connection.java:socket.channel().socket().setKeepAlive(true)— enables TCP keepalive probessocket.channel().socket().setSoLinger(true, 0)— enables immediate teardown on closeBackground
This is part of a larger effort to address stale TCP connections blocking file distribution downloads (split from #35932 per reviewer feedback). The socket options are the smallest, most independent piece.