Skip to content

Fix flaky Sched_Task_ClosureWorkItem_Wait scheduler test#9916

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:fix/flaky-sched-task-closureworkitem-wait
Feb 15, 2026
Merged

Fix flaky Sched_Task_ClosureWorkItem_Wait scheduler test#9916
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:fix/flaky-sched-task-closureworkitem-wait

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Feb 15, 2026

Copy link
Copy Markdown
Member

Summary

This change stabilizes UnitTests.SchedulerTests.OrleansTaskSchedulerBasicTests.Sched_Task_ClosureWorkItem_Wait.

  • Queue closure work items via _rootContext.QueueAction(...) so each closure has an awaitable completion task.
  • Await all closure work items using Task.WhenAll(workItems).WaitAsync(TimeSpan.FromSeconds(10)).
  • Remove short per-item timeout waits which raced scheduler turn completion and caused intermittent timeouts.

Validation

  • dotnet test test\NonSilo.Tests\NonSilo.Tests.csproj --filter "FullyQualifiedName=UnitTests.SchedulerTests.OrleansTaskSchedulerBasicTests.Sched_Task_ClosureWorkItem_Wait" -c Release (repeated 50x with --no-build after first run)
  • dotnet test test\NonSilo.Tests\NonSilo.Tests.csproj --filter "FullyQualifiedName~UnitTests.SchedulerTests.OrleansTaskSchedulerBasicTests" -c Release --no-build

Queue closure work items via QueueAction to await scheduler turn completion deterministically and remove race-prone short waits.

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

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 flaky scheduler test by replacing short per-task timeouts with a single collective timeout for all work items. The test previously raced scheduler turn completion against individual task timeouts, causing intermittent failures.

Changes:

  • Modified Sched_Task_ClosureWorkItem_Wait to use QueueAction<TState> which returns Task objects for tracking work item completion
  • Replaced individual task waits with timeouts with Task.WhenAll().WaitAsync() for collective completion tracking
  • Removed the explicit loop that queued work items separately (now queued inline during creation)

Comment thread test/NonSilo.Tests/SchedulerTests/OrleansTaskSchedulerBasicTests.cs
@ReubenBond ReubenBond added this pull request to the merge queue Feb 15, 2026
Merged via the queue into dotnet:main with commit f9cdaaa Feb 15, 2026
65 checks passed
@ReubenBond ReubenBond deleted the fix/flaky-sched-task-closureworkitem-wait branch February 15, 2026 04:13
rkargMsft pushed a commit to rkargMsft/orleans that referenced this pull request Feb 27, 2026
Fix flaky Sched_Task_ClosureWorkItem_Wait

Queue closure work items via QueueAction to await scheduler turn completion deterministically and remove race-prone short waits.

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