Skip to content

Commit 1eaf339

Browse files
committedDec 22, 2017
Eliminate deadlock when waiting for blocking threads.
I am not sure why this is not needed on master, but it fixes the deadlock in CI right now on 9.1.
1 parent 1fd8a50 commit 1eaf339

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎core/src/main/java/org/jruby/RubyIO.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,12 @@ protected IRubyObject rbIoClose(Ruby runtime) {
20362036

20372037
// interrupt waiting threads
20382038
fptr.interruptBlockingThreads(context);
2039-
fptr.waitForBlockingThreads(context);
2039+
try {
2040+
fptr.unlock();
2041+
fptr.waitForBlockingThreads(context);
2042+
} finally {
2043+
fptr.lock();
2044+
}
20402045
fptr.cleanup(runtime, false);
20412046

20422047
if (fptr.getProcess() != null) {

0 commit comments

Comments
 (0)