Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock witj java3D #9

Closed
EnricoScantamburlo opened this issue Apr 3, 2013 · 8 comments
Closed

Deadlock witj java3D #9

EnricoScantamburlo opened this issue Apr 3, 2013 · 8 comments

Comments

@EnricoScantamburlo
Copy link

We were evaluating Java3D + JOGL and we found a deadlock that did not occur in the old Java3D 1.5.2
We use some Swing Components to print 2d stuff on the 3d Canvas
this is the deadlock;

Found one Java-level deadlock:

"AWT-EventQueue-1":
waiting for ownable synchronizer 0x000000068ec7a388, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
which is held by "J3D-Renderer-1"
"J3D-Renderer-1":
waiting to lock monitor 0x00002aaab0003d98 (object 0x000000068ecd3dc8, a java.awt.Component$AWTTreeLock),
which is held by "AWT-EventQueue-1"

Java stack information for the threads listed above:

"AWT-EventQueue-1":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x000000068ec7a388> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:842)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1178)
at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
at sun.awt.SunToolkit.awtLock(SunToolkit.java:236)
at sun.awt.X11.XDecoratedPeer.getLocationOnScreen(XDecoratedPeer.java:968)
at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1960)
at java.awt.Component.getLocationOnScreen(Component.java:1938)
- locked <0x000000068ecd3dc8> (a java.awt.Component$AWTTreeLock)
at javax.swing.SwingUtilities.convertPointToScreen(SwingUtilities.java:364)
at org.netbeans.core.windows.view.EditorView.getPureBounds(EditorView.java:95)
at org.netbeans.core.windows.view.ViewHierarchy.getPureEditorAreaBounds(ViewHierarchy.java:914)
at org.netbeans.core.windows.view.DefaultView.guessSlideSide(DefaultView.java:120)
at org.netbeans.core.windows.ViewRequestor.guessSlideSide(ViewRequestor.java:113)
at org.netbeans.core.windows.Central.guessSlideSide(Central.java:1815)
at org.netbeans.core.windows.WindowManagerImpl.guessSlideSide(WindowManagerImpl.java:908)
at org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter$WinsysInfo.getOrientation(TabbedAdapter.java:534)
at org.netbeans.swing.tabcontrol.plaf.AbstractViewTabDisplayerUI.showHidePinButton(AbstractViewTabDisplayerUI.java:175)
at org.netbeans.swing.tabcontrol.plaf.AbstractViewTabDisplayerUI$Controller.stateChanged(AbstractViewTabDisplayerUI.java:625)
at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:133)
at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:119)
at org.netbeans.swing.tabcontrol.DefaultTabDataModel.fireContentsChanged(DefaultTabDataModel.java:472)
at org.netbeans.swing.tabcontrol.DefaultTabDataModel.setText(DefaultTabDataModel.java:164)
at org.netbeans.swing.tabcontrol.TabbedContainer.setTitleAt(TabbedContainer.java:704)
at org.netbeans.core.windows.view.ui.TabbedHandler.topComponentNameChanged(TabbedHandler.java:239)
at org.netbeans.core.windows.view.ui.AbstractModeContainer.updateName(AbstractModeContainer.java:191)
at org.netbeans.core.windows.view.ModeView.updateName(ModeView.java:172)
at org.netbeans.core.windows.view.DefaultView.changeGUI(DefaultView.java:362)
at org.netbeans.core.windows.ViewRequestor.dispatchRequest(ViewRequestor.java:272)
at org.netbeans.core.windows.ViewRequestor.processRequest(ViewRequestor.java:248)
at org.netbeans.core.windows.ViewRequestor.postRequest(ViewRequestor.java:186)
at org.netbeans.core.windows.ViewRequestor.scheduleRequest(ViewRequestor.java:126)
at org.netbeans.core.windows.Central.topComponentDisplayNameChanged(Central.java:1562)
at org.netbeans.core.windows.WindowManagerImpl.topComponentDisplayNameChanged(WindowManagerImpl.java:1180)
at org.openide.windows.TopComponent.setName(TopComponent.java:954)
at com.streamsim.toolpanel.ToolPanelController.updateTCTitle(ToolPanelController.java:223)
at com.streamsim.toolpanel.ToolPanelController.updateContext(ToolPanelController.java:179)
at com.streamsim.toolpanel.ToolPanelController.access$600(ToolPanelController.java:43)
at com.streamsim.toolpanel.ToolPanelController$ActNodeSetter.run(ToolPanelController.java:363)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:148)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
"J3D-Renderer-1":
at java.awt.Component.reshape(Component.java:2144)
- waiting to lock <0x000000068ecd3dc8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.reshape(JComponent.java:4156)
at java.awt.Component.setBounds(Component.java:2133)
at com.streamsim.metricspaceplots.mds.view.View3DCanvas.layoutColorMaps(View3DCanvas.java:297)
at com.streamsim.metricspaceplots.mds.view.View3DCanvas.postRender(View3DCanvas.java:171)
at javax.media.j3d.Renderer.doWork(Renderer.java:1375)
at javax.media.j3d.J3dThread.run(J3dThread.java:270)

Found 1 deadlock.

Thanks for your hard work!

@hharrison
Copy link
Owner

Thanks for the report, can you please report this information to the java3d at forum.jogamp.org, that will have a wider audience. Can you also provide the following:

  • java3d version being tested
  • jogl2 version being tested
  • what OS you are using
  • any other details about your program/environment you can share.

Thanks,

Harvey

@hharrison
Copy link
Owner

Enrico,

Could you provide some more details about what you are doing in your postrender method...you're triggering a resize of the Canvas3d in your method which causes the work to be done on the Renderer thread and not the AWT thread which leads to a deadlock in this case.

In particular, what does layoutColorMaps do in your app?

Harvey

@EnricoScantamburlo
Copy link
Author

Sorry for the tardiness,
It was a colleague of mine who got the problem. jogl was rc10 for sure, and we are on the NetBeans platform, I have to ask him the other details. The layoutColorMaps takes a list of JComponents that represent color-scales, it changes their size and prints them on the screen using a J3DGraphics2D object

@hharrison
Copy link
Owner

Thanks for the info, it would be great if you could try jogl2-rc11, or the latest aggregated build available at:

http://jogamp.org/deployment/archive/master/gluegen_656-joal_420-jogl_951-jocl_773/

Just in case that makes any difference and otherwise we'll go from there.

Cheers,

Harvey

@hharrison
Copy link
Owner

Also, if you need to do any swing resizing/etc, don't do it directly in the postRender method, if you can, it
would be safest to use SwingUtilities.invokeLater to ensure all of those actions happen on the swing event dispatch thread and not the Java3d render thread.

Harvey

@ghost
Copy link

ghost commented Jan 14, 2014

Hi

Do you still reproduce this bug with Java3D 1.6 pre9 + JOGL 2.1.4 RC? Have you followed Harvey's advise?

@EnricoScantamburlo
Copy link
Author

Sorry I had not the chance to test your patch, but we resolved the issue not using Swing JComponent methods in the postRender method.

@ghost
Copy link

ghost commented Jan 14, 2014

@EnricoScantamburlo Thank you very much for the feedback.

@hharrison This bug report can be closed, can't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants