-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
$ jruby -v
jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff Java HotSpot(TM) 64-Bit Server VM 9.0.1+11 on 9.0.1+11 +jit [darwin-x86_64]
Expected Behavior
The following executes "forever" without errors on MRI 2.5.3 and JRuby 9.2.7.0:
mutex = Mutex.new
t1 = Thread.new do
loop do
mutex.synchronize do
mutex.sleep 1 # not needed to provoke the error, but just to motivate the t1.run below
end
end
end
loop do
mutex.synchronize do
end
t1.run
endThis is a real-world problem cooked down to its core. The real-world app (a busy web-app) uses https://github.com/sharpstone/rack-timeout, where one can find similar mutex usage.
Actual Behavior
$ jruby mutex.rb
warning: thread "Ruby-0-Thread-1: mutex.rb:1" terminated with exception (report_on_exception is true):
ConcurrencyError: interrupted waiting for mutex
lock at org/jruby/ext/thread/Mutex.java:101
synchronize at org/jruby/ext/thread/Mutex.java:158
mutex.rb at mutex.rb:5
loop at org/jruby/RubyKernel.java:1425
mutex.rb at mutex.rb:4
ThreadError: killed thread
wakeup at org/jruby/RubyThread.java:1279
run at org/jruby/RubyThread.java:1437
mutex.rb at mutex.rb:15
loop at org/jruby/RubyKernel.java:1425
<main> at mutex.rb:11
After some digging around I would assume this is connected to the change in #5683. What I find a bit curious is that the main thread must also try to synchronize to force the error to happen.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels