From: Yusuke ENDOH Date: 2009-11-15T20:50:40+09:00 Subject: [ruby-core:26747] Re: [Bug #2371] [BUG] thread_free: locking _mutex must be NULL Hi -- 2009/11/15 Chris Schlaeger : > Here is how to reproduce the problem: > > 1. Download the taskjuggler gem: http://www.taskjuggler.org/tj3/taskjuggler-0.0.3.gem and install it > 2. change to the 'examples' directory that comes with the gem or download tutorial.tjp from http://www.taskjuggler.org/tj3/examples/tutorial.tjp > 3. while /bin/true ; do tj3 -c 3 tutorial.tjp || break; done > > The -c N option should be set slightly higher than the number of CPU cores in the system. > The program works fine with ruby 1.8.7 PL27. Thank you for your report! Duplicated. A smaller test case: m = Mutex.new Thread.new { m.lock; sleep } sleep 0.2 Thread.new { sleep 0.2; fork { GC.start } } m.lock The following patch should fix the issue. Could you try? diff --git a/thread.c b/thread.c index ba717bd..5ea1982 100644 --- a/thread.c +++ b/thread.c @@ -380,6 +380,7 @@ thread_cleanup_func(void *th_ptr) rb_mutex_unlock_all(th->keeping_mutexes, th); th->keeping_mutexes = NULL; } + th->locking_mutex = Qfalse; thread_cleanup_func_before_exec(th_ptr); native_thread_destroy(th); } -- Yusuke ENDOH