Bug 952 - JAWTWindow's JAWTComponentListener may deadlock due to AWTTreeLock acquisition
Summary: JAWTWindow's JAWTComponentListener may deadlock due to AWTTreeLock acquisition
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: awt (show other bugs)
Version: 2
Hardware: All all
: P2 major
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2014-01-27 14:00 CET by Sven Gothel
Modified: 2014-01-27 18:19 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
b7fafd30ffc5eac73880b264043582d74175a394
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2014-01-27 14:00:41 CET
The AWTTreeLock is acquired by Component.removeHierarchyListener
and as for _every_ AWT component, modifications shall happen on the AWT-EDT.

IMHO the user shall offload AWT modifications to the AWT-EDT
similar to what JOGL's GLCanvas and NEWTCanvasAWT does.

However, since JAWTWindow also represents a NativeWindow instance 
it would not be too bad to offload AWTTreeLock methods ourselves, i.e.:

  boolean wait = false;
  AWTEDTExecutor.singleton.invoke(wait, new Runnable() {
      @Override
      public void run() {
          ... detach .. or attach ..
      } } );


+++

"J3D-Renderer-1" prio=5 tid=0x00007f96dceaf800 nid=0xe103 waiting for monitor entry [0x000000011d9d5000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.awt.Component.removeHierarchyListener(Component.java:5383)
	- waiting to lock <0x00000007f8127338> (a java.awt.Component$AWTTreeLock)
	at com.jogamp.nativewindow.awt.JAWTWindow$JAWTComponentListener.detach(JAWTWindow.java:175)
	at com.jogamp.nativewindow.awt.JAWTWindow$JAWTComponentListener.access$600(JAWTWindow.java:123)
	at com.jogamp.nativewindow.awt.JAWTWindow.destroy(JAWTWindow.java:606)
	at javax.media.j3d.JoglDrawable.destroyNativeWindow(JoglDrawable.java:60)
	at javax.media.j3d.JoglPipeline.destroyContext(JoglPipeline.java:6799)
	at javax.media.j3d.Canvas3D.destroyContext(Canvas3D.java:4651)
	at javax.media.j3d.Renderer.removeCtx(Renderer.java:1551)
	- locked <0x00000007f841de58> (a java.lang.Object)
	at javax.media.j3d.Renderer.doWork(Renderer.java:372)
	at javax.media.j3d.J3dThread.run(J3dThread.java:271)


+++


See <http://forum.jogamp.org/JOGL-commit-166e5da-causes-deadlock-errors-in-Java-3D-tp4031305.html>
Comment 1 Sven Gothel 2014-01-27 18:17:31 CET
b7fafd30ffc5eac73880b264043582d74175a394
  Resolved as described