Skip to content

Fix flakiness in CallChainReentrancy_WithSuppression#9913

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:fix/callchain-reentrancy-suppression-flake
Feb 13, 2026
Merged

Fix flakiness in CallChainReentrancy_WithSuppression#9913
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:fix/callchain-reentrancy-suppression-flake

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Feb 13, 2026

Copy link
Copy Markdown
Member

Summary

  • fix a race in CallChainReentrancyGrain.CallChain by snapshotting _unblocker at invocation start
  • use that snapshot for all Task.WhenAny waits so in-flight calls are not affected by _unblocker reset timing

Root cause

UnblockWaiters signals and then replaces _unblocker. Depending on timing, an in-flight CallChain could read the new unsignaled task, causing an intermittent hang and eventual cancellation while waiting for (Exit, b, 4).

Testing

  • dotnet test test/TesterInternal/TesterInternal.csproj --filter FullyQualifiedName~UnitTests.General.AllowCallChainReentrancyTests.CallChainReentrancy_WithSuppression
  • 50 repeated runs on net8.0
  • 50 repeated runs on net10.0
  • AllowCallChainReentrancyTests on both net8.0 and net10.0
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings February 13, 2026 02:14

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 fixes a race condition in CallChainReentrancyGrain.CallChain that caused intermittent test failures in CallChainReentrancy_WithSuppression. The race occurred when UnblockWaiters replaced _unblocker while CallChain invocations were still in progress. The fix snapshots _unblocker at the start of each CallChain invocation to ensure consistent behavior throughout the call.

Changes:

  • Added local snapshot of _unblocker at the start of CallChain method
  • Updated all three Task.WhenAny calls to use the snapshotted value instead of the field

@ReubenBond ReubenBond added this pull request to the merge queue Feb 13, 2026
Merged via the queue into dotnet:main with commit dead8d4 Feb 13, 2026
65 checks passed
@ReubenBond ReubenBond deleted the fix/callchain-reentrancy-suppression-flake branch February 13, 2026 04:50
rkargMsft pushed a commit to rkargMsft/orleans that referenced this pull request Feb 27, 2026
Fix flaky CallChainReentrancy_WithSuppression test
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 15, 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.

2 participants