Skip to content

drpcserver: bound the ServeOne TLS handshake with an optional timeout#83

Open
rafiss wants to merge 1 commit into
mainfrom
tls-handshake-timeout
Open

drpcserver: bound the ServeOne TLS handshake with an optional timeout#83
rafiss wants to merge 1 commit into
mainfrom
tls-handshake-timeout

Conversation

@rafiss

@rafiss rafiss commented Jul 22, 2026

Copy link
Copy Markdown

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

Tested with a stalled net.Pipe peer (handshake times out promptly) and a zero-timeout case (no deadline is set).

Informs: cockroachdb/cockroach#144754

@rafiss
rafiss requested a review from sanchit-CRL July 22, 2026 17:30
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
rafiss force-pushed the tls-handshake-timeout branch from 48f4752 to 202df95 Compare July 22, 2026 17:38
@rafiss
rafiss requested a review from pritesh-lahoti July 22, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant