Thread suspended while holding global mutex
I am seeing a deadlock in phoneME when trying to attach to the VM using JDB.
When JDB first attaches, the first thing it does is suspend all threads. This seems to be the primary force behind our deadlock. When I attach GDB to the process I can see the state of all native threads and it seems that one of my threads has been suspended while it holds one of the global mutexes in CVMglobals. Eventually, a JVMTI thread gets blocked on this mutex which subsequently holds up all all future JVMTI commands/events.
What mechanism in the VM should be preventing a thread from suspending while holding a global mutex? I do see that before a thread is suspended, the calling thread requests that threads reach consistent state. Is this supposed to be the mechanism?
For example, in CVMobjectInflate(), the calling thread grabs the CVMglobals.syncLock in a GCSafe block. However, while trying to exit the safe code block, it gets blocked in the rendezvous due to an outstanding consistent state request. While it is blocked on the CS mutex/condvar, it gets suspended (still holding the global syncLock).
Any ideas for me on this situation? Is there a problem with the way I'm handling "thread suspend/resume when blocked" in my porting code?