[BUG] deadlock with AWT

There is a DeadLock in JOGL.

The reshape() Methode may be called with the AWT-TreeLock held. Than reshape calls invokeGL, which is synchronized and therefor obtains a new lock.

When a AnimatorThread is used, the invokeGL-method is called directly, but at least the Windows implementation of JOGL call some AWT-Methods (getDeviceConfiguration or something like that) which try to obtain the AWT-TreeLock.

Et voilà: a deadlock.

You seem to use a strategy that i’d call “maximum locking” in the invokeGL-Method. You should only use synchronized in the invokeGL-Method to test for the deferred actions. You can copy the deferred actions into local variables, and then release the lock. In short: the methode invokeGL should not be synchronized, but instead make minimal use of synchronized(this) {}.

Thx
Sven

Are you running JOGL 1.1 b08? We fixed a deadlock like this in the Windows GLCanvas implementation; see Issue 54. If you’ve found another deadlock, could you please file a bug with the JOGL Issue Tracker?

We do currently use a lot of synchronization in invokeGL, but it generally makes the implementation simpler than if we tried to make it finer-grained. In particular, invokeGL is used to perform mutual exclusion among multiple threads trying to use the same OpenGL context, which is trickier if you try to synchronize separately around makeCurrent/free.