Skip to content

UnitTestRunner: run tests on the uncapped normal thread pool - #1838

Merged
Mysticial merged 1 commit into
mainfrom
unit-test-runner-use-unlimited-pool
Nov 3, 2026
Merged

Mysticial merged 1 commit into
mainfrom
unit-test-runner-use-unlimited-pool

Conversation

@pa-devbot

Copy link
Copy Markdown
Collaborator

Summary

The parallel UnitTestRunner dispatches each test via ThreadPool::dispatch_now_blocking(), which blocks the dispatcher thread when the pool is at capacity. It was dispatching into computation_normal() (capped at hardware_concurrency), while the runner itself allows up to 2 * hardware_concurrency concurrent tests.

The mismatch means the dispatcher can park in dispatch_now_blocking() waiting for a pool slot that only frees when a running test finishes. If the running tests are themselves stalled (e.g. blocked inside a log call), no slot frees and the whole run hangs — the kind of CI stall we've been seeing.

Switch both runner constructions (the GUI UnitTestRunner::program and the CLI CommandLineUnitTestRunner::run) to unlimited_normal(). The runner already caps the number of concurrently running tests, so the pool just needs to honor that cap rather than impose a smaller one of its own.

Notes

  • add_tests_QtEventThreadPool(ret, computation_normal()) was left as-is: that's a specific test's internal worker pool (used via run_in_parallel, which is safe on a capped pool), not the runner's dispatch pool.
  • This addresses the runner/pool capacity hazard; the separate logging bottleneck (FileLogger::log blocking when its queue is full) is a follow-up.

The runner dispatches each test via ThreadPool::dispatch_now_blocking(),
which blocks the dispatcher thread when the pool is at capacity. It was
dispatching into computation_normal(), which is capped at
hardware_concurrency, while the runner itself allows up to
2*hardware_concurrency concurrent tests. The mismatch means the dispatcher
can park in dispatch_now_blocking() waiting for a pool slot; combined with
threads stuck mid-task (e.g. in a blocking log call), the whole run can
stall.

Use unlimited_normal() instead: the runner already caps the number of
concurrently running tests, so the pool just needs to be able to honor that
cap rather than impose a smaller one of its own.
@Mysticial
Mysticial merged commit ad1d578 into main Nov 3, 2026
3 of 7 checks passed
@Mysticial
Mysticial deleted the unit-test-runner-use-unlimited-pool branch November 3, 2026 11:13
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.

2 participants