hharrison / java3d-core

Fork of the javax.media.j3d package
GNU General Public License v2.0
85 stars 39 forks source link

Deadlock witj java3D #9

Closed EnricoScantamburlo closed 10 years ago

EnricoScantamburlo commented 11 years ago

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)

Found 1 deadlock.

Thanks for your hard work!

hharrison commented 11 years ago

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:

Thanks,

Harvey

hharrison commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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 commented 10 years ago

Hi

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

EnricoScantamburlo commented 10 years ago

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 commented 10 years ago

@EnricoScantamburlo Thank you very much for the feedback.

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