-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Hit a deadlock where jstack shows a number of threads waiting on a lock but no thread is holding the lock. We were able to reproduce it with the code snippet below. This snippet works (runs indefinitely) on jruby-9.1.17.0 and MRI 2.5.8, but deadlocks on jruby-9.2.9.0 and jruby-9.2.13.0
The suspicion is that the t.kill is killing the thread without releasing the mutex, possible related to this change cc6bf49#diff-7768018ea9b120637b1da8461cb5df2b
def test_it
mutex = Mutex.new
sleep_div = 500
starts = 0
ends = 0
2000.times do |i|
ts = 3.times.map do
Thread.new do
sleep(rand / sleep_div)
mutex.synchronize{ starts += 1; sleep(rand / sleep_div); ends += 1 }
end
end
3.times do
sleep(rand / sleep_div)
t = ts.sample
t.kill
end
if i % 10 == 0
mutex.synchronize do
puts "iter #{i}, starts: #{starts}, ends: #{ends}"
end
end
end
end
if __FILE__ == $0
test_it
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels