Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Willem Rein Oudshoorn <woudshoo@xs...> - 2011-03-07 14:31:20
Just today I had some spare time and decided to look into the
(with-test (:name (:two-threads-running-gc)) ...
test failure on MacOSX.
I see where it deadlocks. It deadlocks in
the pthread library: new_sem_from_pool
on the sem_pool_lock.
This of course should not happen and I have a hard time
pinpointing why and how this exactly happens.
When do I see this
I see the deadlock in the test case above.
1. One thread is in the call gc_stop_the_world,
gc_stop_the_world --> wait_for_thread_state_change -->
pthread_cond_wait --> new_sem_from_pool
2. Two other threads are in sig_stop_for_gc_handler
2a. One thread at
if (thread_state(thread) != STATE_RUNNING)
2b. One thread at
Potential cause of the deadlock
I am not sure, but I think the following scenario can cause the
1. The gc_stop_the_world calls pthread_kill on another thread.
This other thread holds at that moment the
sem_pool_lock because it is in a pthread call.
2. the thread holding the sem_pool_lock is interrupted
while still holding the lock.
3. Dead lock ensues.
But I am not sure if that is what is actually happening.