JOGL/JDK7 RC10+ Display Issue, With Test Case

Posted by rhatcher on
URL: https://forum.jogamp.org/JOGL-JDK7-RC10-Display-Issue-With-Test-Case-tp4025819.html

This problem is related to AWT/JOGL Deadlock, Revisited.  I've started another topic because although the problem presents itself similar to the noted post, the jstack results are slightly different and I thought it best to not mix up the associated files.

Relevant versions:

- Fedora 12
- Sun/Oracle JDK 7u6.
- JOGL/Gluegen I built using JDK 6u33 from a cloned repo as of Friday 8/10/2012 Note that I tried building 08/16 repos but got a failure in jogl building c.build.newt.windowlib.

I've uploaded files JoglHangTest1.java and BigRedXCanvas.java which can be used to reproduce the problem.

In my testing so far this problem appears specific to JDK7, and happens on both 7u5 and 7u6.

The test app will initially create a small window with a single button labeled "Make Frame".  When I press this button on my system when running with JDK7 I get one of three results:

1) Everything will work, and I get the expected JOGL window with a big red X on a black background.

2) The JOGL window will come up but be blank/gray until I wiggle the mouse, at which point it will draw.

3) The JOGL window will come up, be blank/gray, and never draw.  Additionally, the "Make Frame" button will remain depressed and the UI will become unresponsive as shown in this screen snippet.

When I run under JDK 6u33 I so far have always gotten result 1).

However, I ran 72 times (there is nothing special about 72; that's just where I happened to get sick of running the thing) under JDK 7u6 and got result 1) 5 times, result 2) 64 times, and result 3) 3 times.

When result 3 happens I get jstack output like this.

With this particular test app result 3 is almost always a deadlock, though one time I saw it present with the Animator thread stack trace similar to the post I noted at the front of this message.

Can anybody reproduce similar results?


In case it's relevant... the mechanics of the failure noted in AWT/JOGL Deadlock, Revisited are indirectly related to JOGL interrupting the AWT EventDispatchThread as in this stack trace:

    at java.lang.Thread.interrupt(Thread.java:971)
    at java.awt.EventDispatchThread.interrupt(EventDispatchThread.java:97)
    at jogamp.common.util.locks.RecursiveThreadGroupLockImpl01Unfairish.unlock(RecursiveThreadGroupLockImpl01Unfairish.java:195)
    at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.unlock(RecursiveLockImpl01Unfairish.java:264)
    at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:182)
    at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:199)
    at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1914)
    at javax.media.opengl.GLProfile.get(GLProfile.java:848)
    at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:254)
    at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:261)
    at java.lang.Thread.run(Thread.java:741)

Maybe this is normal/expected (?).  But... under JDK7 this - in conjunction with some other AWT stuff that has changed a lot since JDK6 - ultimately renders the AWT event dispatch thread unwilling to process events.  The InvocationEvents for drawing end up getting backed up in a queue that's no longer being serviced, and the event dispatch thread wants to exit but can't meet the required exit conditions.  Because the event dispatch thread can't exit - but also has been interrupted and so will no longer pump events - everything freezes up in the UI.

I could get into the ugly details of it and will do so if you think it will be helpful.