Skip to content

Serialize quarantined async test execution-trace writes - #5142

Open
mdaigle wants to merge 1 commit into
mainfrom
dev/mdaigle/quarantined-flaky-repairs-nov24
Open

mdaigle wants to merge 1 commit into
mainfrom
dev/mdaigle/quarantined-flaky-repairs-nov24

Conversation

@mdaigle

@mdaigle mdaigle commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🤖 This pull request was created by a fully automated workflow.

Description

Repair Microsoft.Data.SqlClient.ManualTesting.Tests.DDAsyncTest.ExecuteCommand_WithNewConnection_ShouldPerformAsyncByDefault (Fact; no arguments).

Demonstrated mechanism: its two reader continuations mutate the same unsynchronized List<string>. CI recorded IndexOutOfRangeException inside List.Add in both continuations. Serialize only execution-trace insertion through a shared helper; database operations and awaits remain concurrent. The shared-connection sibling uses the same insertion rule. Existing assertions, query inputs, conditions and Set=3 are preserved; no product/API or pipeline changes.

Add RecordProcess_ConcurrentReaders_SerializesWrites: hold the first collection insertion open, admit a second writer, and verify it waits outside the collection before both records are retained. This controlled ownership regression fails without the lock on both frameworks; it does not reproduce the exact framework-internal array exception. Document the trace ownership rule in TESTGUIDE.md.

Retain [Trait("category", "flaky")] and add [Trait("category", "probation")] to the affected Fact only. Ordinary selection still excludes it; quarantine still executes it. Probation begins separately on each upstream branch only when the repair and both markings actually merge there, never on PR creation. Later category transitions belong to the independent probation reviewer.

Release routing blocked: the same shared-list defect exists on release/6.1, /7.0, /7.1 and /8.0. Verified intended labels are Hotfix 6.1.9, Hotfix 7.0.5, Hotfix 7.1.3 and Hotfix 8.0.0, respectively. Current release source lacks this Fact's flaky marking; its quarantine backports remain pending (#5133, #5134, #5135 and #5132, respectively). The complete patch fails application checks against all four current snapshots, and documentation needs adaptation (release/7.0 lacks TESTGUIDE.md). No Hotfix labels are applied: compatible whole-diff/category prerequisites need resolution first. Repaired release execution is not claimed.

Issues

#5129 quarantined this same Fact and records its original failure/control pair.

Testing

Local Windows SQL Server with integrated authentication, a uniquely named disposable database and two ten-row tables matching the existing queries. This is limited local data coverage, not the full Northwind fixture. net462/native SNI and net10.0/native and managed SNI executed successfully.

$p = 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTests.csproj'
$scope = 'FullyQualifiedName~DDAsyncTest'
$regression = 'FullyQualifiedName~DDAsyncTest.RecordProcess_ConcurrentReaders_SerializesWrites'
$quarantine = $scope + '&category=flaky'
$ordinary = $scope + '&category!=failing&category!=flaky&category!=interactive'
dotnet restore $p -p:ReferenceType=Project -v:q
dotnet test $p --no-restore --filter $regression -v:q
dotnet test $p --no-restore --filter $scope -v:q
dotnet test $p --no-restore -c Release --filter $scope -v:q
dotnet test $p --no-build --no-restore -c Release --list-tests --filter $quarantine -v:q
dotnet test $p --no-build --no-restore -c Release --list-tests --filter $ordinary -v:q
dotnet test $p --no-build --no-restore -c Release --filter $quarantine -v:q
dotnet test $p --no-build --no-restore -c Release --filter $ordinary -v:q

Restore passed. Unrepaired regression: 1 failed/framework; repaired focused Debug and Release: 3 passed/framework/configuration, no skips. Managed net10.0 repeated both focused configurations with 3 passes each using the same commands plus --framework net10.0. Quarantine discovery/execution selects exactly one affected Fact/framework; ordinary selects two cases/framework (sibling and regression), both passing. SQL configuration was supplied through TEST_MDS_CONFIG; earlier missing-Northwind skips are not counted as passes.

CI: scoped 194755 completed PartiallySucceeded at the repair SHA, with the Unix limitations below. The affected quarantine Fact, ordinary sibling and regression passed in each Windows framework/SNI configuration: 9/9 cases. 194757 completed Succeeded on the identical PR merge tree; ordinary sibling/regression passed on Windows and Linux: 8/8 cases, with the affected Fact excluded. Individual case records and execution mappings add the precise provenance. These records support review readiness, not indefinite stability.

CI limitation: 194755's existing Unix publisher attempts to parse binary coverage files as TRX, so no Linux SQL25 test run was published. Its quarantine task reported five unrelated bulk-copy/transaction failures; no exact Linux quarantine pass is claimed. The archived ZIP is not readable through the available artifact capability. Linux ordinary execution is independently verified in 194757; pipeline definitions and coverage settings remain unchanged.

Guidelines

Please review the contribution guidelines before submitting a pull request:

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 14:18
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Nov 24, 2026
@mdaigle mdaigle added this to the 8.1.0-preview1 milestone Nov 24, 2026

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.

🔵 Needs a closer look

Pending case-level Windows/Linux CI results leave the concurrency regression unverified across platforms, requiring human confirmation before approval.

No open issues 🎉

What changed in this PR

This test-only PR addresses the shared execution-trace race behind the async test quarantined in #5129, without changing SqlClient product behavior.

Changes:

  • Serializes trace insertion in both async reader helpers while leaving database operations concurrent.
  • Adds a SQL Server-independent regression test and documents the trace synchronization rule.
  • Retains flaky and adds probation only to the affected test, preserving quarantine routing.
File Description
TESTGUIDE.md Documents trace synchronization and the regression test.
src/​Microsoft.Data.SqlClient/​tests/​ManualTests/​DDBasics/​DDAsyncTest/​DDAsyncTest.cs Locks shared trace writes, adds concurrency regression coverage, and marks the repaired test for probation.

Review effort: Balanced

@mdaigle

mdaigle commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author
Execution Quarantine record Ordinary records: shared / regression Case UTC: ordinary; quarantine Task logs: ordinary / quarantine
194755 Windows net462/native 102251 101639 / 101681 14:43:15.080-.393; 14:52:26.133-.280 320 / 354
194755 Windows net10.0/native 102405 101704 / 101853 14:43:29.283-30.093; 14:51:10.990-11.137 300 / 334
194755 Windows net10.0/managed 102426 101502 / 101852 14:43:58.613-.940; 14:50:57.650-58.110 299 / 338
194757 Linux net10.0/managed - 100665 / 100686 14:49:40.633-.647; - 560 / -

Dates are 2026-11-24 UTC; job/task attempts are 1. These runs used Debug/Project, with Set=3 in 194755 and Set=123 in 194757. Ordinary ranges span the two linked records. The timestamps uniquely place each record in its mapped task, despite merged Windows run titles.

Unix publication diagnostic, mapped log 302 / Unix archive metadata

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.23%. Comparing base (17bef7b) to head (883be1c).
⚠️ Report is 37 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5142      +/-   ##
==========================================
+ Coverage   68.99%   73.23%   +4.23%     
==========================================
  Files         314      315       +1     
  Lines       45857    71443   +25586     
==========================================
+ Hits        31638    52319   +20681     
- Misses      14219    19124    +4905     
Flag Coverage Δ
CI-SqlClient ?
sqlclient-pr 73.23% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdaigle
mdaigle marked this pull request as ready for review November 24, 2026 15:20
@mdaigle
mdaigle requested a review from a team as a code owner November 24, 2026 15:20

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

Status: To triage

Development

Successfully merging this pull request may close these issues.

4 participants