Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlock in ForkJoinPoolHierarchicalTestExecutorService #3981

Merged

Conversation

leonard84
Copy link
Collaborator

@leonard84 leonard84 commented Sep 11, 2024

Overview

fixes #3945

This PR actually fixes the problem that was attempted in #3936.
That PR is still valid on its own, although it didn't fix the actual problem.
The release notes still apply for this as well.


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


Definition of Done

Co-authored-by: Marc Philipp <[email protected]>
@leonard84 leonard84 force-pushed the leo/fix-for-join-pool-thread-deadlock branch from 6da042f to b2922c5 Compare September 11, 2024 15:48
The service now checks if the `ExclusiveTask` that should run
is executed on a thread that is already executing another task.
If this is scenario is detected, it checks if the lock is compatible to
the enclosing locks.
1. If compatible, it is executed and marked done
2. If incompatible, it is added to a list of deferred tasks and left
   unfinished. The deferred tasks will be re-forked afterward.

fixes junit-team#3945

Co-authored-by: Marc Philipp <[email protected]>
@leonard84 leonard84 force-pushed the leo/fix-for-join-pool-thread-deadlock branch from b2922c5 to d6428b8 Compare September 11, 2024 16:05
@leonard84 leonard84 marked this pull request as draft September 11, 2024 16:39
@marcphilipp marcphilipp self-assigned this Sep 13, 2024
@sbrannen
Copy link
Member

Is the intention to backport this to 5.10.x along with #3936 and #3988?

@sbrannen sbrannen changed the title Fix deadlock in ForkJoinPoolHierarchicalTestExecutorService Fix deadlock in ForkJoinPoolHierarchicalTestExecutorService Sep 13, 2024
@sbrannen
Copy link
Member

Is the intention to backport this to 5.10.x along with #3936 and #3988?

Never mind: I see this is linked to #3945 which is already assigned to 5.10.4.

@marcphilipp marcphilipp merged commit 88f8859 into junit-team:main Sep 17, 2024
15 checks passed
marcphilipp added a commit that referenced this pull request Sep 17, 2024
The service now checks if the `ExclusiveTask` that should run
is executed on a thread that is already executing another task.
If this is scenario is detected, it checks if the lock is compatible to
the enclosing locks.
1. If compatible, it is executed and marked done
2. If incompatible, it is added to a list of deferred tasks and left
   unfinished. The deferred tasks will be re-forked afterwards.

Fixes #3945.

---------

Co-authored-by: Marc Philipp <[email protected]>
@leonard84 leonard84 deleted the leo/fix-for-join-pool-thread-deadlock branch September 17, 2024 11:51
marcphilipp pushed a commit that referenced this pull request Sep 23, 2024
The service now checks if the `ExclusiveTask` that should run
is executed on a thread that is already executing another task.
If this is scenario is detected, it checks if the lock is compatible to
the enclosing locks.
1. If compatible, it is executed and marked done
2. If incompatible, it is added to a list of deferred tasks and left
   unfinished. The deferred tasks will be re-forked afterwards.

Fixes #3945.

---------

Co-authored-by: Marc Philipp <[email protected]>
(cherry picked from commit 88f8859)
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.

Workstealing can lead to deadlocks
3 participants