Skip to content

Handle StreamBuffer disposal race in SslStream test - #133021

Merged
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/fix-sslstream-dispose-test
Sep 2, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/fix-sslstream-dispose-test

Conversation

@rzikm

@rzikm rzikm commented Sep 1, 2026

Copy link
Copy Markdown
Member

Dispose_ParallelWithHandshake_ThrowsODE can surface the expected disposal race through StreamBuffer.TryWriteToBuffer on Alpine, where the ConnectedStreams frame is absent from the stack trace. This caused the test to fail after #132748 narrowed the exception filter to ConnectedStreams.

Accept the two specific StreamBuffer write methods in addition to ConnectedStreams. Matching the methods rather than the entire type avoids hiding unrelated InvalidOperationException failures from StreamBuffer.

Testing: the targeted outer-loop test passed. The full System.Net.Security functional suite ran 5,369 tests; this test passed, with one unrelated failure in TlsSessionTests.ClientSession_ExternalCertificateValidation_AcceptWithDefaultValidation_FailsOnUntrustedCert on the local Windows environment.

Note

This pull request description was created by GitHub Copilot.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: cfe60e99-25a1-4878-9f47-4dff5e9b1537
Copilot AI lite review requested due to automatic review settings September 1, 2026 14:29
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the SslStreamDisposeTest.Dispose_ParallelWithHandshake_ThrowsODE test to treat additional InvalidOperationException stack trace origins as expected during the dispose/handshake race, improving test resilience across platforms/runtimes.

Changes:

  • Expands the exception filter in ValidateExceptionAsync to accept System.IO.StreamBuffer.TryWriteToBuffer and System.IO.StreamBuffer.WriteAsync frames in addition to System.IO.ConnectedStreams.
  • Keeps the filter scoped to specific method names rather than broadly accepting all StreamBuffer failures.
File summaries
File Description
src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs Broadens the expected InvalidOperationException stack-trace filter to cover additional disposal-race call paths.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

@rzikm

rzikm commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

/ba-g sockets test failure is unrelated

@rzikm
rzikm merged commit 2777d66 into dotnet:main Sep 2, 2026
79 of 81 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 3, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants