fix(adonet): prevent provider query races - #10505
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
READCOMMITTEDLOCKis redundant here because SQL Server ignoresREADCOMMITTEDLOCK(andREADCOMMITTED) whenUPDLOCKis specified, which makes the locking strategy less clear without changing behavior. Consider dropping it and keepingUPDLOCK, READPAST, ROWLOCK.
OrleansStreamMessage WITH (UPDLOCK, READPAST, READCOMMITTEDLOCK, ROWLOCK)
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
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
ReubenBond
force-pushed
the
rb-fix-ado-net-chaos-flakes
branch
from
August 11, 2026 21:14
2454a12 to
c77f93d
Compare
This was referenced Aug 28, 2026
Merged
Merged
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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