Skip to content

Fix flaky GrainTimer_Change timer assertion timing#9928

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:copilot/fix-flaky-grain-timer-change
Feb 16, 2026
Merged

Fix flaky GrainTimer_Change timer assertion timing#9928
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:copilot/fix-flaky-grain-timer-change

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Feb 16, 2026

Copy link
Copy Markdown
Member

Summary

  • fix flaky DefaultCluster.Tests.TimerTests.TimerOrleansTest.GrainTimer_Change
  • replace the final fixed Task.Delay(wait) for the dispose_timer case with bounded polling for tick-count convergence
  • keep assertion semantics unchanged (tickCount == 1) while avoiding false negatives from timing jitter

Testing

  • dotnet test test\DefaultCluster.Tests\DefaultCluster.Tests.csproj --filter "FullyQualifiedName=DefaultCluster.Tests.TimerTests.TimerOrleansTest.GrainTimer_Change" -v minimal
  • repeated twice with --no-build (3 consecutive passing runs total)
Microsoft Reviewers: Open in CodeFlow

Replace fixed-delay assertion with bounded polling so dispose_timer callback completion is observed reliably before asserting tick count.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 16, 2026 21:37

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 addresses flakiness in the DefaultCluster.Tests.TimerTests.TimerOrleansTest.GrainTimer_Change test by replacing a fixed delay with bounded polling so the assertion happens once the grain’s tick count has actually been observed to reach the expected value.

Changes:

  • Replaced a fixed Task.Delay(wait) with a bounded polling loop for the "dispose_timer" path in GrainTimer_Change.
  • Cached the polled tick count and asserted against that value to reduce timing-jitter false negatives.

@ReubenBond ReubenBond enabled auto-merge February 16, 2026 21:45
@ReubenBond ReubenBond added this pull request to the merge queue Feb 16, 2026
Merged via the queue into dotnet:main with commit 74b3fc1 Feb 16, 2026
65 checks passed
@ReubenBond ReubenBond deleted the copilot/fix-flaky-grain-timer-change branch February 16, 2026 23:02
rkargMsft pushed a commit to rkargMsft/orleans that referenced this pull request Feb 27, 2026
Fix flaky GrainTimer_Change timer assertion

Replace fixed-delay assertion with bounded polling so dispose_timer callback completion is observed reliably before asserting tick count.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 19, 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