Repository navigation
Fix shared-transaction test worker starvation - #5094
Conversation
Use dedicated workers for the synchronous transaction handoff so the waiting consumer cannot occupy the worker needed by the producer. Preserve flaky quarantine and add probation. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for this test-only change that removes shared-transaction workers’ dependence on thread-pool availability.
No open issues 🎉
What changed in this PR
This test-only repair removes thread-pool availability as a dependency of the shared-transaction connection-pool test. Production code, public APIs, and pipelines are unchanged.
Changes:
- Uses two
LongRunningtasks onTaskScheduler.Default, preserving transaction handling, handoff timeout, and connection-identity assertions. - Removes an unused synchronization event and replaces the obsolete failure commentary with behavior-focused documentation.
- Retains
flakyquarantine and addsprobationtracking.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/WaitHandleDbConnectionPoolTransactionTest.cs | Isolates workers from thread-pool starvation and updates test documentation and probation metadata. |
Review effort: Balanced
|
Execution mappings below use stage/phase/job attempts; each mapped task is attempt 1. Times are UTC on 2026-11-17.
Mapped prerequisite logs: scoped build / 150.
|
|
Very cool analysis |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5094 +/- ##
==========================================
+ Coverage 68.99% 69.98% +0.99%
==========================================
Files 314 315 +1
Lines 45857 69808 +23951
==========================================
+ Hits 31638 48855 +17217
- Misses 14219 20953 +6734
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:
|
Use dedicated workers for the synchronous transaction handoff so the waiting consumer cannot occupy the worker needed by the producer. Preserve flaky quarantine and add probation. Co-authored-by: Malcolm Daigle <[email protected]> Co-authored-by: Copilot App <[email protected]>
Use dedicated workers for the synchronous transaction handoff so the waiting consumer cannot occupy the worker needed by the producer. Preserve flaky quarantine and add probation. Co-authored-by: Malcolm Daigle <[email protected]> Co-authored-by: Copilot App <[email protected]>
🤖 This pull request was created by a fully automated workflow.
Description
Repair
Microsoft.Data.SqlClient.UnitTests.ConnectionPool.WaitHandleDbConnectionPoolTransactionTest.TwoThreads_SharedTransaction_AccessSameTransactedEntry(Fact; no arguments).Demonstrated mechanism: the caller synchronously waits for two
Task.Runworkers, and the consumer synchronously waits for the producer. With no spare pool worker,Task.WaitAllcan inline the consumer ahead of the queued producer, causing the existing ten-second handoff assertion to fail. An isolated child process restricted to one worker reproduced the recorded assertion on both net462 and net10.0; this is a controlled starvation scenario, not a reconstruction of the original agent's exact load.Use two dedicated
LongRunningtasks onTaskScheduler.Default, preserving transaction flow, handoff order, timeout and connection-identity assertions. Remove the unused event and replace the obsolete “never reproduces locally” comment with behavior documentation. No production, API or pipeline changes.Retain
[Trait("category", "flaky")]and add[Trait("category", "probation")]. Probation starts separately on each upstream branch only when its repair and both traits actually merge there. This unmerged proposal starts no probation interval; later category transitions belong to the independent reviewer.Release applicability: the same defective method exists on release/7.1 and release/8.0, and the complete one-file repair/category diff applies cleanly to both. The existing
Hotfix 7.1.3andHotfix 8.0.0labels are applied. The method is absent from release/6.1 and release/7.0. Release-branch binaries, including 7.1's net8.0/net9.0 targets, have not been executed.Issues
The existing method-level quarantine records this same timeout; no separate issue is closed.
Testing
Both commands passed 27 net462 + 27 net10.0, zero failures/skips, including neighboring sync/async transaction coverage. The identical isolated single-worker control failed before this repair and passed afterward on both frameworks; repaired Release controls also passed net462 x86/x64 and net10.0 x64. No process-wide worker limits are changed by the committed test.
Actual discovery and Release execution with
FullyQualifiedName~WaitHandleDbConnectionPoolTransactionTest&category=flakyselected/passed exactly this one Fact per framework. The ordinarycategory!=failing&category!=flaky&category!=interactiveconjunction excluded it and selected/passed all 26 siblings per framework. Both useddotnet testwith--no-build --no-restoreand the same project above; discovery additionally used--list-tests.CI: scoped build 192845, on the repair SHA with Release/Project/Set 1, verified this Fact in quarantine and all 27 transaction-class cases on Windows SQL25 x86/net462 (native-SNI configuration). PR build 192846, on merge
d68a1fcc80d4f712aa7a2b83a58d132eb6a71d44, verified all 26 ordinary transaction siblings on Linux net10.0 Debug/Project and excluded this Fact. These tests use mock connections, not physical SQL/SNI connectivity.CI limits: scoped Windows net10.0 tests did not execute because PowerShell module restoration received feed HTTP 403 (missing Reader permission). Latest PR build 192870, on the same merge SHA, again failed that prerequisite in two Windows managed-SNI manual jobs; it supplies no additional affected-case pass. The focused
sqlclient-ci-unitalternative cannot load on the repair SHA because its configured/eng/pipelines/ci/unit/sqlclient-ci-unit-pipeline.ymlis absent. Ubuntu24 SQL25/net10.0 managed-SNI quarantine reported 34 passes with no skips, but its XML result-publication failure persisted after an unchanged retry and also occurs on unrepaired main. No individual Linux quarantine pass is claimed. Linked execution records and failure controls are in the single evidence comment.Guidelines
Please review the contribution guidelines before submitting a pull request:
Contributing
Code of Conduct
Best Practices
Coding Style
Review Process
Tests added or updated.
Public API changes documented (not applicable: test-only repair).
Verified against customer repro (not applicable: controlled CI-test scheduling reproduction).
Ensure no breaking changes introduced.