Deadlock in RVMThread code
--------------------------
Key: RVM-870
URL:
http://jira.codehaus.org/browse/RVM-870 Project: RVM
Issue Type: Bug
Components: Runtime: Threads and Concurrency
Affects Versions: 3.1.0
Reporter: Eddie Aftandilian
In RVMThread.java, there is a static Monitor handshakeLock that prevents multiple handshakes from occurring at the same time. This lock must be acquired by the GC thread to block the mutator threads, and it also must be acquired when a new thread is created in order to allocate and initialize a communication lock for the thread.
In RVMThread.assignThreadSlot(), we have this code:
handshakeLock.lockWithHandshake();
if (communicationLockBySlot[threadSlot] == null) {
communicationLockBySlot[threadSlot] = new Monitor();
}
handshakeLock.unlock();
"new Monitor()" allocates, which can cause a GC. If it does cause a GC, it does not release the handshakeLock, so the GC thread cannot acquire the handshakeLock in hardHandshakeSuspend() and the GC cannot proceed.
----------------------
I believe we can fix this by moving the new Monitor allocation outside the lock:
Monitor m = new Monitor();
handshakeLock.lockWithHandshake();
if (communicationLockBySlot[threadSlot] == null) {
communicationLockBySlot[threadSlot] = m;
}
handshakeLock.unlock();
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Jikesrvm-issues mailing list
Jikesrvm-issues@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-issues