Surface locked problem when computer has been awaked from sleep mode

Hello!

I have a problem with jogl in some special situation:

  1. I run jogl program, it successfully works.
  2. I go out from my computer.
  3. Computer goes to sleep, shutdowns monitor, etc.
  4. I hit any key and computer is awaking from sleep mode.
  5. After computer has been awaked from sleep mode my working jogl program start to produce “Surface locked” exceptions.

Are there any way to fix this issue?

What operating system, graphics card, JDK version and JOGL version are you using? I see no problems on my Windows notebook with NVidia graphics when running the Gears demo, putting it to sleep, and waking it back up.

I have tried on Gears demo. Unfortunately, issue is causing.

My configuration is following:

  • Windows XP Home Edition 2002, SP 2
  • ATI Technologies Inc., RADEON X700 SE x86/SSE2, GL_VERSION: 2.0.5279 WinXP Release
  • jre1.6.0
  • jogl-1.1.0-rc1-windows-i586.zip

Step to reproduce:

  • Run Gears demo
  • Switch to different user (log off and log on as different user)
  • Return back to first user. Now, computer is in sleep mode.
  • Hit any key. The computer is awaking from sleeping mode. The Gears demo start to produce javax.media.opengl.GLException: Surface already locked

A stack trace is following:

exception in QueueFlusher:
javax.media.opengl.GLException: Error making context current: 0
	at com.sun.opengl.impl.windows.WindowsGLContext.makeCurrentImpl(WindowsGLContext.java:169)
	at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:65)
	at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
	at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:305)
	at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(Unknown Source)
exception in QueueFlusher:
javax.media.opengl.GLException: Surface already locked
	at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:157)
	at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
	at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
	at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:305)
	at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(Unknown Source)

Thanks for the report. While I can’t reproduce the failure you see on my NVidia hardware, the problem in JOGL’s on-screen GLContext implementations is apparent from your stack traces. The specification of GLContext.makeCurrent() isn’t very precise in this area, but there’s an assumption that if an exception is thrown, the state of the GLContext is reset so that a subsequent call to makeCurrent() has a chance of succeeding. At least, all of the code in the JOGL source base assumes that, and doesn’t call release() if makeCurrent() throws an exception.

I’ve filed and fixed Issue 260 to address this problem. Please try a nightly build dated 1/18 or later and post to let us know whether this works. Note, however, that you’ll have to call setIgnoreExceptions(true) (and, preferably, setPrintExceptions(true)) on your Animator to work around the underlying problem of makeCurrent() throwing the initial exception, though hopefully that’s transient behavior. By the way, that is a driver bug which you should report to ATI.

The latest build works quite fine. It throws several times exception, but not in endless loop and program does not fails! Thanks for patch!