JVM won't die after shader compile

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

JVM won't die after shader compile

Jeffg
I have a Windows 7 machine, that runs a jogl app and the app exits fine (as far as closing it from the screen).  However, the JVM is not terminating in the background.  It stays active then jumps to 100% cpu on a core.  I've isolate the piece of code that's causing the issue though.

      gl.glCompileShaderARB(vertexShader);

But the shaders are working just fine.  The glGetInfoLog reports that the shader compiled successfully.  But for some reason, when I exit the application, the JVM won't terminate.

I've tried this... but it doesn't help.

      gl.glUseProgramObjectARB(0);
      gl.glDetachShader(programObject, vertexShader);
      gl.glDeleteShader(vertexShader);
      gl.glDetachShader(programObject, fragmentShader);
      gl.glDeleteShader(fragmentShader);
      gl.glDeleteObjectARB(programObject);

Reply | Threaded
Open this post in threaded view
|

Re: JVM won't die after shader compile

Jeffg
This post was updated on .
Ok.. I got it to die.. but perhaps someone could give me some advice on minimizing the potential damage I may be doing, if any. Here is what I had to do.


try {
if (OS.startsWith("Windows")) {
String pidstr = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
String pid[] = pidstr.split("@");
Runtime.getRuntime().exec("taskkill /F /PID " + pid[0]).waitFor();
}
}
catch (Exception e) {
}
Reply | Threaded
Open this post in threaded view
|

Re: JVM won't die after shader compile

Sven Gothel
Administrator
On Friday, November 12, 2010 20:53:41 Jeff [via jogamp] wrote:
>
> Ok.. I got it to die.. but perhaps someone could give me some advice on
> minimizing the potential damage I may be doing, if any. Here is what I had
> to do.
>
> System.exit(0);

thx ..

we have to investigate this.

windows only I guess ..

maybe a non deamon thread is still alive ?

use jstack -l <pid>, or jvisualvm
when the app is waiting forever ..


>
> try {
> if (OS.startsWith("Windows")) {
> String pidstr =
> java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
> String pid[] = pidstr.split("@");
> Runtime.getRuntime().exec("taskkill /F /PID " + pid[0]).waitFor();
> }
> }
> catch (Exception e) {
> }
>
> ______________________________________
> View message @ http://jogamp.762907.n3.nabble.com/JVM-won-t-die-after-shader-compile-tp1877330p1891121.html
> To start a new topic under jogl, email [hidden email]
> To unsubscribe from jogl, click http://jogamp.762907.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=782158&code=c2dvdGhlbEBqYXVzb2Z0LmNvbXw3ODIxNTh8NDU1NjU4MjUx
>


--
health & wealth
mailto:[hidden email] ; http://jausoft.com
land : +49 (471) 4707742 ; cell: +49 (151) 28145941
Timezone CET: PST+9, EST+6, UTC+1
Reply | Threaded
Open this post in threaded view
|

Re: JVM won't die after shader compile

Jeffg
Ok.. ran jstack (as admin).  It runs fine when the program is running (output is below).  If I close the application (JVM still running because it won't close), jstack gives me "Access Denied".

Here is the output of the running application:

2010-11-15 10:04:04
Full thread dump Java HotSpot(TM) Client VM (17.1-b03 mixed mode):

"Direct Clip" daemon prio=6 tid=0x4a414400 nid=0xaf8 in Object.wait() [0x4f75f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19933720> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19933720> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a413c00 nid=0x25c in Object.wait() [0x4f70f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19933840> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19933840> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a413800 nid=0x930 in Object.wait() [0x4f6bf000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19933960> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19933960> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a413000 nid=0x6ec in Object.wait() [0x4f5ff000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19933a80> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19933a80> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a412c00 nid=0x5d8 in Object.wait() [0x4f56f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19933ba0> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19933ba0> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a412400 nid=0x7c8 in Object.wait() [0x4f51f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19922d50> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x19922d50> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a412000 nid=0x658 in Object.wait() [0x4e59f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3958> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x198c3958> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a411800 nid=0xd00 in Object.wait() [0x4e54f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3a78> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x198c3a78> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a014400 nid=0x3bc in Object.wait() [0x4e4ff000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3b98> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x198c3b98> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4a1e3800 nid=0xd40 in Object.wait() [0x4e4af000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3cb8> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x198c3cb8> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Direct Clip" daemon prio=6 tid=0x4f7dbc00 nid=0x7ac in Object.wait() [0x4e45f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3dd8> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x198c3dd8> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Java Sound Event Dispatcher" daemon prio=6 tid=0x4a424400 nid=0xb44 in Object.wait() [0x4dcff000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x198c3ef8> (a com.sun.media.sound.EventDispatcher)
        at java.lang.Object.wait(Object.java:485)
        at com.sun.media.sound.EventDispatcher.dispatchEvents(Unknown Source)
        - locked <0x198c3ef8> (a com.sun.media.sound.EventDispatcher)
        at com.sun.media.sound.EventDispatcher.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"DestroyJavaVM" prio=6 tid=0x01951c00 nid=0x8cc waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"D3D Screen Updater" daemon prio=8 tid=0x4a065400 nid=0xce4 in Object.wait() [0x4f03f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at sun.java2d.d3d.D3DScreenUpdateManager.run(Unknown Source)
        - locked <0x190c39a8> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Animation Thread" prio=6 tid=0x49f73800 nid=0xd88 runnable [0x4efef000]
   java.lang.Thread.State: RUNNABLE
        at com.sun.opengl.impl.windows.WGL.SwapBuffers(Native Method)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.swapBuffers(WindowsOnscreenGLDrawable.java:131)
        at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:345)
        at processing.core.PApplet.handleDraw(PApplet.java:1627)
        at processing.core.PApplet.run(PApplet.java:1503)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"AWT-EventQueue-0" prio=6 tid=0x49f4fc00 nid=0xf60 in Object.wait() [0x4d84f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x190575a8> (a java.awt.EventQueue)
        at java.lang.Object.wait(Object.java:485)
        at java.awt.EventQueue.getNextEvent(Unknown Source)
        - locked <0x190575a8> (a java.awt.EventQueue)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"AWT-Windows" daemon prio=6 tid=0x4a0bdc00 nid=0x938 runnable [0x4a76f000]
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WToolkit.eventLoop(Native Method)
        at sun.awt.windows.WToolkit.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"AWT-Shutdown" prio=6 tid=0x49fa1400 nid=0xa34 in Object.wait() [0x4a56f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x190101b0> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:485)
        at sun.awt.AWTAutoShutdown.run(Unknown Source)
        - locked <0x190101b0> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Java2D Disposer" daemon prio=10 tid=0x49f18400 nid=0x394 in Object.wait() [0x4a51f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19010248> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x19010248> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at sun.java2d.Disposer.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Low Memory Detector" daemon prio=6 tid=0x01a1a400 nid=0xb74 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"CompilerThread0" daemon prio=10 tid=0x01a00c00 nid=0xbe4 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Attach Listener" daemon prio=10 tid=0x019fb000 nid=0xc14 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Signal Dispatcher" daemon prio=10 tid=0x019f7c00 nid=0xc04 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Finalizer" daemon prio=8 tid=0x019cd000 nid=0x3e4 in Object.wait() [0x49d3f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x190104a0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x190104a0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

   Locked ownable synchronizers:
        - None

"Reference Handler" daemon prio=10 tid=0x019c8800 nid=0xa8 in Object.wait() [0x49cef000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x19010530> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:485)
        at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
        - locked <0x19010530> (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
        - None

"VM Thread" prio=10 tid=0x019c6000 nid=0x51c runnable

"VM Periodic Task Thread" prio=10 tid=0x01a1bc00 nid=0xd44 waiting on condition

JNI global references: 2004
Reply | Threaded
Open this post in threaded view
|

Re: JVM won't die after shader compile

Jeffg
Correction above.. I didn't have System.exit(0) before my "taskkill" as I never needed System.exit() in the past as it closed normally. If I do put in System.exit(0) before my taskkill, the taskkill never runs but the JVM doesn't shut down either. Runtime.getRuntime().halt(1) didn't work either. So something is happening locking up the actual Java Shutdown due to the glCompileShader.
Reply | Threaded
Open this post in threaded view
|

Re: JVM won't die after shader compile

Sven Gothel
Administrator
On Monday, November 15, 2010 17:14:01 Jeffg [via jogamp] wrote:

>
> Correction above.. I didn't have System.exit(0) before my "taskkill" as I
> never needed System.exit() in the past as it closed normally. If I do put in
> System.exit(0) before my taskkill, the taskkill never runs but the JVM
> doesn't shut down either. Runtime.getRuntime().halt(1) didn't work either.
> So something is happening locking up the actual Java Shutdown due to the
> glCompileShader.
>
> ______________________________________
> View message @ http://jogamp.762907.n3.nabble.com/JVM-won-t-die-after-shader-compile-tp1877330p1905420.html
> To start a new topic under jogl, email [hidden email]
> To unsubscribe from jogl, click http://jogamp.762907.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=782158&code=c2dvdGhlbEBqYXVzb2Z0LmNvbXw3ODIxNTh8NDU1NjU4MjUx
>

Jeff,

have I mentioned:
  http://jogamp.org/wiki/index.php/Jogl_FAQ#Bugreports_.26_Testing
?? :)

Because then I would have known that this is an AMD driver issue in relation with
AMD's GLSL out of process compiler and the JVM.

While doing the final tests today on Windows, I ran into it with AMD driver 10.10 - 10.11 !
10.09 hangs 'only' a few seconds (around 5-10s maybe).

Here are the other posts I have found (I guess yours):
  http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=285876&page=1
  http://forums.amd.com/devforum/messageview.cfm?catid=392&threadid=141999&enterthread=y

Would have been much more helpful (saved time),
if you would have referenced all this information in the 1st place, sorry for nagging :)

I guess we need a solution here.
IMHO AMD fixes this 'behavior' (I would call it a bug),
since I don't know what we possibly could do about it.

Have you or anybody else made any progress ?

In the meantime I only can say, downgrade to 10.09.

Cheers, Sven