Skip to content

Fix double return of the TLS handshake's timeout source in TcpServer - #307

Open
ferociousbyte wants to merge 1 commit into
dotnet:developfrom
ferociousbyte:fix/tcpserver-timeout-scope
Open

ferociousbyte wants to merge 1 commit into
dotnet:developfrom
ferociousbyte:fix/tcpserver-timeout-scope

Conversation

@ferociousbyte

@ferociousbyte ferociousbyte commented Oct 24, 2026 •

Copy link
Copy Markdown

Fixes #306. After the TLS handshake the timeout scope is reset, so the connection's finally no longer returns the same pooled CancellationTokenSource a second time (which threw ObjectDisposedException from async void HandleConnection on shutdown and could share one source between two connections).

Includes a regression test.

This change was made with the help of an AI model (Claude). I can't set labels on this repository; could a maintainer please add ai_assisted?

After the TLS handshake the timeout scope was returned to the multiplexer's
pool but not reset, so a connection that ended before its first message
returned it again in HandleConnection's finally. If the pooled source had
been disposed meanwhile (e.g. canceled by another connection's handshake
timeout, or on shutdown), TryReset threw ObjectDisposedException from the
async void method and the process terminated; otherwise the same source
could be handed to two connections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ferociousbyte

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

@ferociousbyte
ferociousbyte marked this pull request as draft October 24, 2026 09:05
@ferociousbyte
ferociousbyte marked this pull request as ready for review October 24, 2026 09:05

This branch has not been deployed

No deployments
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