Skip to content

fix(adonet): prevent provider query races - #10505

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-ado-net-chaos-flakes
Aug 11, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-ado-net-chaos-flakes

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

ADO.NET provider tests exposed intermittent SQL Server streaming deadlocks and a MariaDB grain-registration race under concurrent operations.

Use skip-locked reads under read-committed locking for SQL Server dequeue and eviction batches so competing consumers can make progress without deadlocking. Use a locking current read after MariaDB grain-registration upserts so concurrent unregister operations cannot produce an empty registration result.

Fixes: #10498

Copilot AI lite review requested due to automatic review settings August 11, 2026 21:05

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.

Pull request overview

This PR updates the ADO.NET provider SQL scripts to reduce intermittent concurrency failures observed in provider chaos/streaming tests, specifically by adjusting locking behavior for SQL Server streaming message dequeue/eviction and MariaDB/MySQL grain directory registration.

Changes:

  • SQL Server streaming: add skip-locked/row-level locking hints to dequeue and eviction batch reads to avoid consumer deadlocks and improve forward progress under contention.
  • MariaDB/MySQL grain directory: add a locking read (FOR UPDATE) after registration upserts to prevent races with concurrent unregister operations.
Show a summary per file
File Description
src/AdoNet/Orleans.Streaming.AdoNet/SQLServer-Streaming.sql Adds table hints to reduce deadlocks and improve concurrency for message dequeue and eviction batches.
src/AdoNet/Orleans.GrainDirectory.AdoNet/MySQL-GrainDirectory.sql Adds SELECT ... FOR UPDATE in RegisterGrainActivation to prevent concurrent unregister from causing an empty/incorrect registration read.

Review details

Tip

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

Suppressed comments (1)

src/AdoNet/Orleans.Streaming.AdoNet/SQLServer-Streaming.sql:579

  • READCOMMITTEDLOCK is redundant here because SQL Server ignores READCOMMITTEDLOCK (and READCOMMITTED) when UPDLOCK is specified, which makes the locking strategy less clear without changing behavior. Consider dropping it and keeping UPDLOCK, READPAST, ROWLOCK.
		OrleansStreamMessage WITH (UPDLOCK, READPAST, READCOMMITTEDLOCK, ROWLOCK)
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/AdoNet/Orleans.Streaming.AdoNet/SQLServer-Streaming.sql Outdated
Copilot AI review requested due to automatic review settings August 11, 2026 21:12
Use skip-locked row-level reads for SQL Server stream batches and a locking current read for MySQL grain registration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 599d20d0-2788-40b3-bab7-f793133c3bf7
Keep READCOMMITTEDLOCK for READPAST compatibility and remove the mutually exclusive ROWLOCK hint from skip-locked scans.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 599d20d0-2788-40b3-bab7-f793133c3bf7

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.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ReubenBond
ReubenBond force-pushed the rb-fix-ado-net-chaos-flakes branch from 2454a12 to c77f93d Compare August 11, 2026 21:14
@ReubenBond
ReubenBond merged commit 6ff0516 into dotnet:main Aug 11, 2026
71 of 73 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-ado-net-chaos-flakes branch August 11, 2026 21:37
This was referenced Aug 28, 2026
This was referenced Sep 3, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 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 test: ADO.NET chaos tests fail intermittently across providers

2 participants