Re: [2.0 RC3] PBuffer uses awtlock during display
Posted by Tovi on Sep 22, 2011; 8:44am
URL: https://forum.jogamp.org/2-0-RC3-PBuffer-uses-awtlock-during-display-tp3355580p3358087.html
Hey Sven,
Thanks for the fast reply. Here's the stack trace on how GLDrawable gets to AWTLock:
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Unsafe.java:-1)
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.reflect.GeneratedMethodAccessor4.invoke(Unknown Source:-1)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jogamp.nativewindow.jawt.JAWTUtil.awtLock(JAWTUtil.java:195)
at jogamp.nativewindow.jawt.JAWTUtil.lockToolkit(JAWTUtil.java:224)
at jogamp.nativewindow.jawt.x11.X11JAWTToolkitLock.lock(X11JAWTToolkitLock.java:51)
at javax.media.nativewindow.DefaultGraphicsDevice.lock(DefaultGraphicsDevice.java:128)
at javax.media.nativewindow.ProxySurface.lockSurface(ProxySurface.java:94)
at jogamp.opengl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:186)
at jogamp.opengl.GLContextImpl.makeCurrentLocking(GLContextImpl.java:435)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:388)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:328)
at jogamp.opengl.GLPbufferImpl.invokeGL(GLPbufferImpl.java:289)
at jogamp.opengl.GLPbufferImpl.display(GLPbufferImpl.java:148)
I've tried your suggestion, and it seems to fix my specific test, but in more general cases it sometimes causes a JVM crash. I'm still investigating the exact cause for this, but I'm assuming that if locking is disabled completely, a crash can occur because of concurrency? Is there a way to lock something else (some static object) instead of awt?
In any case, thanks again for the fast reply, for now I'll try to work with GLProfile.initSingleton and see if I can fix the JVM crash it seems to cause sometimes.
If I get some time I'll examine your tests and send you a test to reproduce the issue. :)
Regards,
Tovi