Retry peer-reset timeouts in socket disposal tests on BSD/Apple - #133371
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
There was a problem hiding this comment.
🟢 Approval recommended
The change is test-only, narrowly scoped, and the retry behavior is constrained to the flaky peer-reset observation case on specific platforms.
Pull request overview
This PR makes the TcpReceiveSendGetsCanceledByDispose functional test more resilient on Apple/FreeBSD by allowing an existing retry loop to also retry peer-side reset observation timeouts (while keeping local cancellation/disposal timeouts as immediate failures), and ensures socket1 is disposed even on exceptional exits.
Changes:
- Wrap
socket1in ausingto guarantee cleanup on all exits from the retry body. - On Apple/FreeBSD send path, convert peer-receive
TimeoutExceptioninto an assertion failure soRetryHelpercan retry with fresh sockets.
File summaries
| File | Description |
|---|---|
| src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs | Updates the retry/cleanup behavior in TcpReceiveSendGetsCanceledByDispose to handle peer-reset timeouts on Apple/FreeBSD and ensure socket1 disposal. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to test resilience with platform guards, preserves the core assertion, and improves resource cleanup without altering product code.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
/ba-g Quic failure is unrelated |
Fixes #131990.
TcpReceiveSendGetsCanceledByDisposecan time out waiting for the peerto observe a reset after local cancellation has succeeded. This is
consistent with the documented BSD TCP reset-validation issue:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296594
The existing retry loop handles assertion failures, but not
TimeoutException. Convert only peer-receive timeouts on Apple/FreeBSDsend paths into logged assertion failures, allowing the existing
eight-attempt loop to retry with fresh sockets.
This preserves the peer-reset assertion. Timeouts waiting for local
cancellation or disposal still fail immediately. Also ensure the sending
socket is disposed on exceptional exits.
Validation
Iteration 174 encountered a peer-reset timeout in
SendReceive_Apm;the same test then passed after retry, exercising the recovery path.
Helix results and captured retry
Note
This change and description were prepared with GitHub Copilot.