Backport #2240
returning from Monitor#synchronize causes 'ThreadError: killed thread' when no waiting thread is alive
| Status: | Closed | Start date: | 10/21/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | - |
Description
def test_killed_thread_in_synchronize
ary = []
queue = Queue.new
t1 = Thread.start {
queue.pop
@monitor.synchronize {
ary << :t1
}
}
t2 = Thread.start {
queue.pop
@monitor.synchronize {
ary << :t2
}
}
@monitor.synchronize do
queue.enq(nil)
queue.enq(nil)
assert_equal([], ary)
t1.kill
t2.kill
ary << :main
end
assert_equal([:main], ary)
end
Associated revisions
* lib/monitor.rb (MonitorMixin.mon_release): ensure the scheduled
thread to be alive when a thread is releasing a monitor. #2240
History
Updated by Hiroshi Nakamura over 2 years ago
NOTE: 1.9 (ruby 1.9.2dev (2009-10-20 trunk 25411) [i686-linux]) is safe.
Updated by Hiroshi Nakamura over 2 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r25420. Hiroshi, thank you for your reporting of the issue. You have greatfully contributed toward Ruby. May Ruby be with you.
Updated by Hiroshi Nakamura over 2 years ago
Title must be '... when the scheduled thread is not alive' as you see the fix.
Updated by Shyouhei Urabe about 2 years ago
- Status changed from Closed to Assigned
- Assignee set to Kirk Haines
1.8.6 also fails on this test case.
Updated by Kirk Haines over 1 year ago
- Status changed from Assigned to Closed
This issue was solved with changeset r28232. Hiroshi, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.