fix(transactions): release locks when cancel precedes prepare - #10743
Merged
ReubenBond merged 3 commits intoAug 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an ordering gap in the Orleans transactions participant path where a cancel can arrive before a prepare has been enqueued, previously leaving a pre-prepare lock held and allowing late prepares to persist orphaned remote-commit state that could stall subsequent transactions.
Changes:
- Release the participant pre-prepare lock when
NotifyOfCancelobserves no commit-queue entry (cancel-before-prepare ordering). - Add a focused unit test asserting that a cancel before prepare results in a broken lock state for the transaction.
Show a summary per file
| File | Description |
|---|---|
| test/Transactions/Orleans.Transactions.Tests/TransactionRecoveryLatencyTests.cs | Adds a regression test for cancel-before-prepare breaking the participant lock. |
| src/Orleans.Transactions/State/TransactionQueue.cs | Updates cancel handling to rollback the RW lock when the commit-queue entry is missing (cancel overtakes prepare). |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
ReubenBond
force-pushed
the
rb-fix-transaction-recovery-stall
branch
from
August 21, 2026 14:01
9500e77 to
b72251c
Compare
This was referenced Aug 28, 2026
Merged
This was referenced Sep 9, 2026
Closed
This was referenced Sep 16, 2026
Open
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.
Problem
A transaction manager can abort while participant prepare messages are still in flight. The cancel fan-out can arrive first, and the participant previously treated a missing commit-queue entry as already complete while retaining its pre-prepare lock. A late prepare then persisted an orphaned remote commit, blocking later transactions until the 60-second recovery ping and allowing repeated recovery probes to extend the stall.
Solution
Release and service the participant lock when a cancel arrives before the prepare has entered the commit queue. The late prepare then observes a broken lock and completes through the abort path without creating durable pending state. Add focused coverage for the cancel-before-prepare ordering.
Rationale
Transaction IDs are unique and lock rollback is idempotent, so the same path remains safe for duplicate or already-completed cancels while closing the ordering gap that produced the recovery cascade.
Closes #10714
Microsoft Reviewers: Open in CodeFlow