Skip to content

Conversation

@marcphilipp
Copy link
Member

@marcphilipp marcphilipp commented Oct 13, 2025

This PR introduces a new implementation of HierarchicalTestExecutorService that runs rests in parallel and has limited work stealing capabilities but is not based on ForkJoinPool. It avoids its pitfalls (such as #3945) and #3108 but may require additional threads because its work stealing is limited to direct children. Contrary to the ForkJoinPool implementation, the new executor service guarantees that no more than parallelism test nodes are executed in parallel.

My intention is to initially ship this implementation as an opt-in feature (via the new junit.jupiter.execution.parallel.executor configuration parameter) in 6.1, make it an opt-out feature in 6.2, and drop support for the ForkJoinPool-based implementation in a later to-be-determined release.

The PR is not yet finished but feedback is already welcome! If you use parallel test execution in your projects (or other test engines), it would be great if you could try out the new implementation and report your observations.

Resolves #3108.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more remarks. LGTM.

}
if (!entriesRequiringResourceLocks.isEmpty()) {
// One entry at a time to avoid blocking too much
tryToStealWork(entriesRequiringResourceLocks.get(0), BlockingMode.BLOCKING);
Copy link
Contributor

@mpkorstanje mpkorstanje Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entries can be stolen by other workers so, this restarts scanning the queue from the beginning too early.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed e7791ae

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought of something.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Nov 6, 2025

CI failing on 85ccf17 from main.

@marcphilipp marcphilipp merged commit 24bfbca into main Nov 6, 2025
17 checks passed
@marcphilipp marcphilipp deleted the marc/parallel-execution-custom-implementation branch November 6, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JUnit parallel executor running too many tests with a fixed policy

3 participants