Skip to content

fix(test): retry SQL Server deadlock victims - #10901

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-10900-sql-server-setup-deadlock
Aug 28, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-10900-sql-server-setup-deadlock

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Problem

SQL Server can choose the test database reset command as a deadlock victim while stale test sessions are being rolled back. The existing bounded retry only handles error 3702, so transient error 1205 fails fixture initialization even though the next reset succeeds.

Solution

Classify SQL Server errors 1205 and 3702 as retryable database-reset failures. Each retry keeps the existing pool clearing behavior, while unrelated errors and the final failed attempt continue to surface.

Rationale

SQL Server explicitly guarantees that a deadlock victim's transaction is rolled back and can be rerun. Reusing the established three-attempt reset boundary handles that transient outcome without masking persistent setup failures.

Fixes #10900

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 28, 2026 09:57

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.

Copilot review overview

Review tier: Lite
Findings: None

What changed in this PR

This PR improves resilience of the SQL Server ADO.NET test database reset path in Orleans’ relational test utilities by treating SQL Server deadlock-victim failures as transient and retryable, reducing fixture initialization flakiness (per #10900).

Changes:

  • Extend the bounded database reset retry logic to treat SQL Server error 1205 (deadlock victim) as retryable alongside 3702 (database in use).
  • Add a focused unit test which validates the retryable/non-retryable classification for representative SQL error codes.
File Description
test/​Extensions/​Orleans.AdoNet.Tests/​RelationalUtilities/​SqlServerStorageForTesting.cs Adds retryable error classification and uses it in DropDatabaseAsync retry filtering/logging.
test/​Extensions/​Orleans.AdoNet.Tests/​RelationalUtilities/​SqlServerStorageForTestingTests.cs Adds a theory to validate which SQL Server error numbers are treated as retryable for database reset.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ReubenBond
ReubenBond merged commit 3483396 into dotnet:main Aug 28, 2026
74 checks passed
@ReubenBond
ReubenBond deleted the rb-10900-sql-server-setup-deadlock branch August 28, 2026 15:49
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky SQL Server setup deadlocks while dropping OrleansStreamTest

2 participants