[fix] lock interruptibly / interrupt thread#5490
Closed
alexis779 wants to merge 1 commit intojruby:masterfrom
Closed
[fix] lock interruptibly / interrupt thread#5490alexis779 wants to merge 1 commit intojruby:masterfrom
alexis779 wants to merge 1 commit intojruby:masterfrom
Conversation
kares
reviewed
Dec 3, 2018
| thread.lockInterruptibly(lock); | ||
| } catch (InterruptedException ie) { | ||
| context.pollThreadEvents(); | ||
| throw context.runtime.newConcurrencyError("interrupted waiting for mutex"); |
Member
There was a problem hiding this comment.
ConcurrencyError is JRuby specific, not sure what MRI does but maybe raise an Interrupt here?
Member
There was a problem hiding this comment.
Interrupt is probably not right because it typically corresponds to SIGINT and usually leads to termination of the runtime. This patch basically undoes a "fix" I did in #4261. Simply going back to interruptible/Interrupted exception would undo that "fix" and break LogStash. We need a better option.
Member
|
this one is pretty much defunct - the alternative from #5683 got merged for 9.2.8.0 |
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.
Fixes #5476
Revert lock commit to be able to interrupt thread trying to acquire a lock.
Otherwise deadlock may appear if lock was already acquired by another thread.
Thread#joinwould block forever even thoughThread#killwas called right before:This is equivalent to following Java test
2 conditions need to happen to avoid getting stuck
Thread#lockInterruptiblyto acquire lockThread#interruptto unblock threadThread Dumps
Here are the thread dumps to illustrate the deadlock:
Main thread:
New thread: