Fix a deadlock that can happen when mutliple stages execute parallelly in a worker#16524
Closed
LakshSingla wants to merge 3 commits intoapache:masterfrom
Closed
Fix a deadlock that can happen when mutliple stages execute parallelly in a worker#16524LakshSingla wants to merge 3 commits intoapache:masterfrom
LakshSingla wants to merge 3 commits intoapache:masterfrom
Conversation
asdf2014
reviewed
Jun 5, 2024
processing/src/main/java/org/apache/druid/frame/processor/Bouncer.java
Outdated
Show resolved
Hide resolved
|
This pull request has been marked as stale due to 60 days of inactivity. |
|
This pull request/issue has been closed due to lack of activity. If you think that |
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.
Description
This PR fixes up a deadlock that can happen when a worker executes multiple stages in parallel. The deadlock happens because, under the above circumstance, there are multiple instances of
RunAllFullyWidgetsharing a singleBouncer.The deadlock happens as follows:
The bouncer hands out tickets to
RunAllFullyWidget1andRunAllFullyWidget2. Two threads callcleanup()on the two widgets at the same time:Thread1 has the lock on
RunAllFullyWidget1and Thread2 has the lock onRunAllFullyWidget2(since they have entered thecleanup()method).cleanup()gives back the tickets that the widgets have acquired to the bouncer.Thread1 giving back the ticket triggers the listener on the
RunAllFullyWidget2to acquire the ticket.Thread2 giving back the ticket triggers the listener on the
RunAllFullyWidget1to acquire the ticket.However, the above operations can't succeed, since each thread holds up the lock the other thread needs.
Jstack of the deadlock. Thanks @Akshat-Jain for providing the JStack
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Release note
Key changed/added classes in this PR
MyFooOurBarTheirBazThis PR has: