Fix managed SNI MARS receive teardown race - #4680
cheenamalhotra wants to merge 2 commits into
Conversation
Handle disposed TCP and named-pipe streams through SNI errors and preserve MARS packet ownership during receive re-arm failure. Add deterministic and SQL-backed regression coverage for #4679. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The concurrency-sensitive packet ownership changes require human review, particularly because the live SQL regression remains unexecuted.
Pull request overview
Fixes #4679 by safely handling managed SNI disposal while MARS re-arms receives.
Changes:
- Captures TCP/named-pipe streams and reports disposal as SNI errors.
- Preserves packet ownership during MARS error propagation.
- Adds transport-level and SQL-backed regression coverage.
File summaries
| File | Description |
|---|---|
SniTcpHandle.netcore.cs |
Handles disposed TCP streams safely. |
SniNpHandle.netcore.cs |
Handles disposed named-pipe streams safely. |
SniMarsConnection.netcore.cs |
Corrects packet lifetime during receive failures. |
SniReceiveTests.cs |
Adds deterministic receive and packet-reuse tests. |
MarsReceiveTeardownTest.cs |
Adds SQL-backed MARS teardown coverage. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The concurrency-sensitive teardown and packet-ownership changes require final human review and completion of pending Windows CI.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4680 +/- ##
==========================================
- Coverage 71.88% 64.59% -7.30%
==========================================
Files 290 284 -6
Lines 45056 68050 +22994
==========================================
+ Hits 32389 43954 +11565
- Misses 12667 24096 +11429
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Prevent unobserved receive-continuation exceptions during managed SNI MARS teardown.
Issues
Fixes #4679
Testing
Deterministic TCP/named-pipe coverage includes disposed streams, idle and pending sessions, cleared tasks, repeated errors, and packet reuse. Fixed the fake peer's unread SYN writes and write/read ordering.
31 focused unit tests and eight live SQL Server 2025 teardown cases pass on .NET 8, 9, and 10 Debug, plus .NET 9 Release. SQL cases are reported separately instead of running an opaque 200-iteration loop. Windows CI is pending for the latest correction.
Guidelines