Fix flaky GrainTimer_Change timer assertion timing#9928
Merged
ReubenBond merged 1 commit intoFeb 16, 2026
Conversation
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>
Contributor
There was a problem hiding this comment.
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 inGrainTimer_Change. - Cached the polled tick count and asserted against that value to reduce timing-jitter false negatives.
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>
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.
Summary
DefaultCluster.Tests.TimerTests.TimerOrleansTest.GrainTimer_ChangeTask.Delay(wait)for thedispose_timercase with bounded polling for tick-count convergencetickCount == 1) while avoiding false negatives from timing jitterTesting
dotnet test test\DefaultCluster.Tests\DefaultCluster.Tests.csproj --filter "FullyQualifiedName=DefaultCluster.Tests.TimerTests.TimerOrleansTest.GrainTimer_Change" -v minimal--no-build(3 consecutive passing runs total)Microsoft Reviewers: Open in CodeFlow