Repository navigation
UnitTestRunner: run tests on the uncapped normal thread pool - #1838
Merged
Merged
Conversation
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.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The parallel
UnitTestRunnerdispatches each test viaThreadPool::dispatch_now_blocking(), which blocks the dispatcher thread when the pool is at capacity. It was dispatching intocomputation_normal()(capped athardware_concurrency), while the runner itself allows up to2 * hardware_concurrencyconcurrent 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::programand the CLICommandLineUnitTestRunner::run) tounlimited_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 viarun_in_parallel, which is safe on a capped pool), not the runner's dispatch pool.FileLogger::logblocking when its queue is full) is a follow-up.