From: John Carter Date: 2009-05-19T14:39:21+09:00 Subject: [ruby-core:23500] [Backport #1471] "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7 Issue #1471 has been updated by John Carter. File ruby_1_8_7_reset_waitfor_on_dead_threads.patch added File ruby_1_8_7_thread_adjust_join.patch added Ok, That fix wasn't sufficient. There were still other deadlock issues, which I believe I have now fixed. In eval.c in rb_thread_schedule we have the following code handling the case of a thread we are waiting to join that has died.... if (th->wait_for & WAIT_JOIN) { if (rb_thread_dead(th->join)) { th->status = THREAD_RUNNABLE; found = 1; } Note that we have updated the th->status, but we have left the th->wait_for unchanged! Adding... th->wait_for = 0; resolved the problem. In the new function rb_thread_set_join that Nobu added... http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/eval.c?r1=23316&r2=23432 he sets th->wait_for to WAIT_JOIN. I see this as a precondition for this function to be called. Attached is two patches relative to 1.8.7-p160 ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1471 ---------------------------------------- http://redmine.ruby-lang.org