Skip to content

Flaky test: WaitsFor_Performance_Many_Quick_Polls times out on starved Windows CI runner #7325

Closed

Description

@thomhurst

What happened

WaitsFor_Performance_Many_Quick_Polls (tests/TUnit.Assertions.Tests/WaitsForAssertionTests.cs:249) failed on modularpipeline (windows-latest) for PR #7281 (a Renovate dependency bump that doesn't touch assertions code):

AssertionException: Expected assertion to pass within 5000 milliseconds (polling every 10ms)
but assertion did not pass within 5000ms after 18 attempts. Last error: Expected to be greater than 20

That failure aborted the pipeline, so PackTUnitFilesModule and the other modules show as cancelled (Attempting to cancel the build...). They were not real failures.

Cause

The test requires 21 polls at a 10 ms interval inside a 5 s timeout, and then requires the elapsed time to be under 5 s. Only 18 polls completed in 5 s, roughly 280 ms per poll, so the thread pool and timers on the runner were starved while the pipeline ran many test modules in parallel. The test measures wall-clock throughput on a shared CI machine rather than the behaviour of WaitsFor.

Expected

The test should check that WaitsFor keeps polling until the predicate passes, and it should not depend on runner speed. For example:

  • use a generous timeout (e.g. 30 s) so the poll count is the only real condition, and
  • drop or loosen the stopwatch.Elapsed < 5s assertion, which only measures CI load.

Earlier WaitsFor timing fixes: #6576, #7176 (and #7169).

Reproduce

Run TUnit.Assertions.Tests with --treenode-filter "/*/*/WaitsForAssertionTests/WaitsFor_Performance_Many_Quick_Polls" on a CPU-starved machine, e.g. with a parallel CPU stress load.

Activity

  1. added
    P2Medium: edge case, mode divergence, flaky test, or workaround exists
    on Nov 1, 2026
  2. thomhurst commented on Nov 1, 2026

    @thomhurst
    OwnerAuthor

    Another occurrence on PR #7357 (Windows matrix, run 41361347135): 19 attempts in 5000 ms, last value 20. Each poll took about 260 ms against a 10 ms interval while the other test modules were starting. The rest of the run passed, and the failed job has been re-run.

  3. added 2 commits that reference this issue on Nov 3, 2026
    560cbb4
    b2041a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: edge case, mode divergence, flaky test, or workaround existsbugSomething isn't workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions