Skip to content

fix(test): remove placement timeout race - #10898

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-fix-placementservice-timeout
Aug 28, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-fix-placementservice-timeout

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 28, 2026

Copy link
Copy Markdown
Member

Problem

GetOrPlaceActivationAsync_WhenLookupDoesNotComplete_TimesOut advances its fake clock to fire the placement timeout, then requires the resulting asynchronous cancellation propagation to complete within one second of wall-clock time. Under the loaded Windows BVT process, that continuation can be delayed long enough for the real-time delay to win even though the timeout has fired correctly.

Solution

Await the placement task directly using the xUnit cancellation token and assert its timeout outcome. This preserves a bounded test while removing the scheduler race between the placement continuation and an unrelated wall-clock delay.

Fixes #10852

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 28, 2026 08:33

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.

Copilot review overview

Review tier: Lite
Findings: None

What changed in this PR

Removes a timing-sensitive race in an Orleans runtime placement timeout unit test by switching from a Task.WhenAny(..., Task.Delay(...)) wall-clock gate to awaiting the placement task directly with xUnit’s cancellation token, aligning the test with how timeouts are driven via FakeTimeProvider.

Changes:

  • Replaces Task.WhenAny(placementTask, Task.Delay(1s)) + Assert.Same with placementTask.WaitAsync(TestContext.Current.CancellationToken) inside Assert.ThrowsAsync<TimeoutException>.
  • Keeps the existing assertions on the TimeoutException and its Polly.Timeout.TimeoutRejectedException inner exception.
File Description
test/​Orleans.Core.Tests/​Runtime/​PlacementServiceTests.cs Updates the flaky timeout test to avoid a wall-clock scheduling race while still keeping the await bounded by the test runner’s cancellation token.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ReubenBond
ReubenBond merged commit ef3e57d into dotnet:main Aug 28, 2026
74 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-placementservice-timeout branch August 28, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky PlacementService timeout test on Windows

2 participants