I'm using QuickTime for Java with Java 1.4.2 under Mac OS X 10.3.8. I
just got a deadlock, which I'm trying to make sure I understand. The
JVM itself detected a deadlock between the finalizer thread and the
AWT event queue. In the event loop I'm calling disposeQTObject() on a
QTObject, which obviously happend at exactly the same time as the
finalizer was disposing another QTObject.
Both the finalizer and disposeQTObject() call QTObject.finalize(),
which is protected by two locks:
So, theoretically I shouldn't get a deadlock, because disposing a
QuickTime object, either explicitly or via the garbage collector,
should acquire the locks in the same order.
However, the JVM deadlock detector reported a deadlock, as far as I
can tell because the AWT event queue is waiting for the termination
lock (which is owned by the Finalizer), and the Finalizer wants the
globalsLock, which is owned by the event loop.
That's what the deadlock detector says, and the thread dump indeed
shows that the Finalizer owns the QTSession.terminationlock. However,
it doesn't show the event queue as owning any other locks.
Digging deeper, it seems that QTSession.terminationLock is the same
as com.apple.mrj.macos.toolbox.Toolbox.LOCK, which conceivably sounds
like something the event loop might acquire while processing events.
Assuming I'm reading what the debugger tells me correctly, I have two
questions:
a) Is it possible for the JVM deadlock detector to report a thread as
owning a monitor even if the corresponding thread dump does not list
that thread as owning it?
b) If this analysis is correct, does it suggest that calling
disposeQTObject() from the AWT event loop is not permitted as it is
deadlock prone?
I'm not sure who the best people to direct this question to are - as
it relates to the internals of AWT, JVM and QuickTime for Java!
-Rolf
--
Rolf Howarth, Square Box Systems Ltd, Stratford-upon-Avon UK.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden