drpcserver: bound the ServeOne TLS handshake with an optional timeout#83
Open
rafiss wants to merge 1 commit into
Open
drpcserver: bound the ServeOne TLS handshake with an optional timeout#83rafiss wants to merge 1 commit into
rafiss wants to merge 1 commit into
Conversation
ServeOne performs the TLS handshake explicitly so it can populate the peer connection info before serving requests. That handshake had no deadline, so a peer that completes the TCP connection but then stalls mid-handshake (never sending its ClientHello flight) would pin the serving goroutine and its file descriptor indefinitely. Add an Options.TLSHandshakeTimeout field. When positive, ServeOne sets a deadline on the connection for the duration of the handshake and clears it once the handshake returns, so it does not affect subsequent reads and writes on the established connection. A zero value preserves the existing behavior (no deadline), keeping the change backward compatible. Informs: cockroachdb/cockroach#144754 Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
rafiss
force-pushed
the
tls-handshake-timeout
branch
from
July 22, 2026 17:38
48f4752 to
202df95
Compare
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.
ServeOneperforms the TLS handshake explicitly (so it can populate peer connection info before serving requests), but that handshake had no deadline. A peer that completes the TCP connection and then stalls mid-handshake — never sending its ClientHello flight — would pin the serving goroutine and its file descriptor indefinitely.This adds an
Options.TLSHandshakeTimeoutfield. When positive,ServeOnesets a deadline on the connection for the duration of the handshake and clears it once the handshake returns, so it does not affect subsequent reads and writes on the established connection. A zero value preserves the existing behavior (no deadline), keeping the change backward compatible.Tested with a stalled
net.Pipepeer (handshake times out promptly) and a zero-timeout case (no deadline is set).Informs: cockroachdb/cockroach#144754