java 6: cannot exit my game

hello,

i just switched my jogl-game to java6 and whenever i quit my game using System.exit(0); it hangs up at that point.
does anyone have a solution to this?

thanks!

More information?
Code?

well, the code i use to exit the game is really nothing more than
System.exit(0);

and what happens exactly, is that the window seems to freeze. the opengl rendering stops and the whole frame does not react anymore.

GeForce 7, winXP, java6, jogl

Probably best moved to the JOGL forum.

Cas :slight_smile:

ok, then can someone move this over there please?
or should i repost it? :slight_smile:

edit: just saw in my debugger view, that almost all threads continue to run, even though i call System.exit(0); and the execution then hangs in the line where System.exit(0) stands.

Are the threads that are still running threads that you’ve made?

well, some of them are my own ones, and there are also the java ones like:
AWT-Windows
Java2D Queue Flusher
Destroy JavaVM
AWT-Shutdown
AWT-EventQueue0

it seems the only two threads that are stopped are the incoming and outgoing network threads.

Can you please run the jstack tool against the hung Java process (or use Ctrl-\ on Unix or Ctrl-Break on Windows) to get a thread dump and post it?

ok, thanks! these are my VM paramters

-Xmx256m
-Dsun.java2d.opengl=true

and here is the full stack trace


2006-12-19 10:27:52
Full thread dump Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode):

"Thread-2" daemon prio=6 tid=0x038b9c00 nid=0xe80 runnable [0x086bf000..0x086bfa94]
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WToolkit.shutdown(Native Method)
        at sun.awt.windows.WToolkit.access$200(Unknown Source)
        at sun.awt.windows.WToolkit$3.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"ClientMessageListenerThread" prio=6 tid=0x03851400 nid=0xe20 in Object.wait() [0x0893f000..0x0893fc14]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at marauroa.client.net.ThreadedNetworkClientManager.getMessage(ThreadedNetworkClientManager.java:137)
        - locked <0x1168a068> (a marauroa.client.net.ThreadedNetworkClientManager)
        at marauroa.client.ariannexp.loop(ariannexp.java:399)
        at com.company.product.client.PapermintClient$1.run(PapermintClient.java:318)

"NetworkClientManagerRead" prio=6 tid=0x032e2000 nid=0xe10 runnable [0x088ef000..0x088efc94]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainDatagramSocketImpl.receive0(Native Method)
        - locked <0x1168d230> (a java.net.PlainDatagramSocketImpl)
        at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
        - locked <0x1168d230> (a java.net.PlainDatagramSocketImpl)
        at java.net.DatagramSocket.receive(Unknown Source)
        - locked <0x10139ca0> (a java.net.DatagramPacket)
        - locked <0x1168bc60> (a java.net.DatagramSocket)
        at marauroa.client.net.ThreadedNetworkClientManager$NetworkClientManagerRead.run(ThreadedNetworkClientManager.java:346)

"FlashThread" prio=6 tid=0x036d7400 nid=0xaf0 runnable [0x06d3f000..0x06d3fd94]
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WComponentPeer.hide(Native Method)
        - locked <0x1165dfb0> (a sun.awt.windows.WCanvasPeer)
        at java.awt.Component.removeNotify(Unknown Source)
        - locked <0x115d9ca8> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.remove(Unknown Source)
        - locked <0x115d9ca8> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.remove(Unknown Source)
        - locked <0x115d9ca8> (a java.awt.Component$AWTTreeLock)
        at com.company.product.client.flash.FlashShell.run(FlashShell.java:137)
        at java.lang.Thread.run(Unknown Source)

"ResourceManagerThread" daemon prio=10 tid=0x03730800 nid=0x774 in Object.wait() [0x0636f000..0x0636fa14]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at com.company.product.common.resourcemanagement.RessourceManager.waitForResources(RessourceManager.java:223)
        - locked <0x115f45d8> (a com.company.product.common.resourcemanagement.RessourceManager)
        at com.company.product.common.resourcemanagement.RessourceManager.run(RessourceManager.java:158)
        at java.lang.Thread.run(Unknown Source)

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

"AWT-EventQueue-0" prio=6 tid=0x03851c00 nid=0xc9c in Object.wait() [0x060ef000..0x060efb14]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.Thread.join(Unknown Source)
        - locked <0x115e82e0> (a java.lang.Thread)
        at java.lang.Thread.join(Unknown Source)
        at java.lang.ApplicationShutdownHooks.run(Unknown Source)
        at java.lang.Shutdown.runHooks(Unknown Source)
        at java.lang.Shutdown.sequence(Unknown Source)
        at java.lang.Shutdown.exit(Unknown Source)
        - locked <0x2015ab88> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Runtime.exit(Unknown Source)
        at java.lang.System.exit(Unknown Source)
        at com.company.product.client.PapermintClient.quit(PapermintClient.java:245)
        at com.company.product.client.KeyProcessor.keydown(KeyProcessor.java:101)
        at com.company.product.client.MainFrame.keyPressed(MainFrame.java:1068)
        at java.awt.Component.processKeyEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        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)


had to split this in 2 messages. part2:



"Thread-3" prio=6 tid=0x02b9e400 nid=0xb2c in Object.wait() [0x0609f000..0x0609fb94]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:485)
        at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.flushNow(Unknown Source)
        - locked <0x115d50c0> (a sun.java2d.opengl.OGLRenderQueue$QueueFlusher)
        at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.flushAndInvokeNow(Unknown Source)
        - locked <0x115d50c0> (a sun.java2d.opengl.OGLRenderQueue$QueueFlusher)
        at sun.java2d.opengl.OGLRenderQueue.flushAndInvokeNow(Unknown Source)
        at sun.java2d.opengl.OGLUtilities.invokeWithOGLContextCurrent(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.opengl.impl.Java2D.invokeWithOGLContextCurrent(Java2D.java:282)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:266)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at com.sun.opengl.util.Animator.display(Animator.java:144)
        at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
        at java.lang.Thread.run(Unknown Source)

"AWT-Windows" daemon prio=6 tid=0x037ed400 nid=0xbdc runnable [0x05f4f000..0x05f4fc14]
   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)

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

"Java2D Queue Flusher" daemon prio=6 tid=0x037d2400 nid=0xc44 runnable [0x03f9f000..0x03f9fd14]
   java.lang.Thread.State: RUNNABLE
        at com.sun.opengl.impl.JAWT.GetDrawingSurface0(Native Method)
        at com.sun.opengl.impl.JAWT.GetDrawingSurface(JAWT.java:52)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:162)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:127)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
        at sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run(Unknown Source)
        - locked <0x115d50c0> (a sun.java2d.opengl.OGLRenderQueue$QueueFlusher)

"Java2D Disposer" daemon prio=10 tid=0x0376ac00 nid=0x55c in Object.wait() [0x03f4f000..0x03f4fd94]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x115d51d0> (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)

"Thread-0" daemon prio=6 tid=0x0362b800 nid=0xb84 in Object.wait() [0x03e9f000..0x03e9fa14]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x114f8758> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x114f8758> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at org.apache.batik.util.CleanerThread.run(Unknown Source)

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

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

"JDWP Command Reader" daemon prio=6 tid=0x02bb7000 nid=0x4b8 runnable [0x00000000..0x00000000]
   java.lang.Thread.State: RUNNABLE

"JDWP Event Helper Thread" daemon prio=6 tid=0x02bb6000 nid=0x984 runnable [0x00000000..0x00000000]
   java.lang.Thread.State: RUNNABLE

"JDWP Transport Listener: dt_socket" daemon prio=6 tid=0x02bb3c00 nid=0xe7c runnable [0x00000000..0x02e9fae0]
   java.lang.Thread.State: RUNNABLE

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

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

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

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

"VM Thread" prio=10 tid=0x02b91c00 nid=0xb20 runnable

"VM Periodic Task Thread" prio=10 tid=0x02bc6000 nid=0xc5c waiting on condition

JNI global references: 4824

I think you need to avoid blocking the AWT Event Dispatch Thread during shutdown. Take a look at the source code for the Gears demo and note that it runs System.exit() on a newly-created thread.

ok, thanks!

i tried this code now, but without any success.

		Thread exitus = new Thread("exitus") {
			public void run() {
				System.exit(0);
			}
		};
		exitus.start();

Can you try removing the -Dsun.java2d.opengl=true parameter?

There have been some bugs related to cooperation between JOGL’s heavyweight GLCanvas and the Java 2D/OpenGL pipeline. Basically, if you’re running Java SE 6 with -Dsun.java2d.opengl=true, you should be taking advantage of the faster GLJPanel instead of using a GLCanvas.

yeah i tried that already too.
unfortunately it also didnt change anything.

thanks though.

couldn’t it be possible, that this problem has nothing to do with jogl at all?
since all the threads seem to be running?

Unlikely. Could you post another thread dump with both the System.exit() call in a new thread as well as using -Dsun.java2d.noddraw=true (instead of -Dsun.java2d.opengl=true)?

thanks!
ok, certainly here is the new stack dump.
btw; i always had this code anyways:


		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				new Thread(new Runnable() {
					public void run() {
						animator.stop();
						System.exit(0);
					}
				}, "QuitThread").start();

stack part 1:


2006-12-20 10:30:37
Full thread dump Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing):

"Thread-2" daemon prio=6 tid=0x034a1400 nid=0x890 runnable [0x084af000..0x084afc94]
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WToolkit.shutdown(Native Method)
        at sun.awt.windows.WToolkit.access$200(Unknown Source)
        at sun.awt.windows.WToolkit$3.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

"exitus" prio=6 tid=0x03644400 nid=0x88c in Object.wait() [0x0845f000..0x0845fd14]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.Thread.join(Unknown Source)
        - locked <0x195dca30> (a java.lang.Thread)
        at java.lang.Thread.join(Unknown Source)
        at java.lang.ApplicationShutdownHooks.run(Unknown Source)
        at java.lang.Shutdown.runHooks(Unknown Source)
        at java.lang.Shutdown.sequence(Unknown Source)
        at java.lang.Shutdown.exit(Unknown Source)
        - locked <0x2ce12640> (a java.lang.Class for java.lang.Shutdown)
        at java.lang.Runtime.exit(Unknown Source)
        at java.lang.System.exit(Unknown Source)
        at com.company.product.client.PapermintClient$1.run(PapermintClient.java:247)

"ClientMessageListenerThread" prio=6 tid=0x0324a800 nid=0x9b4 runnable [0x0874f000..0x0874fa14]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Thread.yield(Native Method)
        at com.company.product.client.PapermintClient$2.run(PapermintClient.java:325)

"NetworkClientManagerRead" prio=6 tid=0x0367fc00 nid=0x9ac runnable [0x086ef000..0x086efa94]
   java.lang.Thread.State: RUNNABLE
        at java.net.PlainDatagramSocketImpl.receive0(Native Method)
        - locked <0x196852e0> (a java.net.PlainDatagramSocketImpl)
        at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
        - locked <0x196852e0> (a java.net.PlainDatagramSocketImpl)
        at java.net.DatagramSocket.receive(Unknown Source)
        - locked <0x180bf0b8> (a java.net.DatagramPacket)
        - locked <0x19685320> (a java.net.DatagramSocket)
        at marauroa.client.net.ThreadedNetworkClientManager$NetworkClientManagerRead.run(ThreadedNetworkClientManager.java:346)

"FlashThread" prio=6 tid=0x034a4400 nid=0x8f8 runnable [0x06b1f000..0x06b1fb94]
   java.lang.Thread.State: RUNNABLE
        at sun.awt.windows.WComponentPeer.hide(Native Method)
        - locked <0x19658c10> (a sun.awt.windows.WCanvasPeer)
        at java.awt.Component.removeNotify(Unknown Source)
        - locked <0x195c5e10> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.remove(Unknown Source)
        - locked <0x195c5e10> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.remove(Unknown Source)
        - locked <0x195c5e10> (a java.awt.Component$AWTTreeLock)
        at com.company.product.client.flash.FlashShell.run(FlashShell.java:137)
        at java.lang.Thread.run(Unknown Source)

"ResourceManagerThread" prio=6 tid=0x02b66c00 nid=0x194 in Object.wait() [0x05c4f000..0x05c4fc14]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at com.company.product.common.resourcemanagement.RessourceManager.waitForResources(RessourceManager.java:223)
        - locked <0x195ea230> (a com.company.product.common.resourcemanagement.RessourceManager)
        at com.company.product.common.resourcemanagement.RessourceManager.run(RessourceManager.java:158)
        at java.lang.Thread.run(Unknown Source)

stack part 2:



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

"AWT-EventQueue-0" prio=6 tid=0x0363c400 nid=0x89c runnable [0x043cf000..0x043cfd14]
   java.lang.Thread.State: RUNNABLE
        at com.sun.opengl.impl.JAWT.GetDrawingSurface0(Native Method)
        at com.sun.opengl.impl.JAWT.GetDrawingSurface(JAWT.java:52)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:162)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:127)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        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)

"Thread-3" prio=6 tid=0x0316c400 nid=0x8a4 in Object.wait() [0x0437f000..0x0437fd94]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:485)
        at java.awt.EventQueue.invokeAndWait(Unknown Source)
        - locked <0x183300f8> (a java.awt.EventQueue$1AWTInvocationLock)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:269)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at com.sun.opengl.util.Animator.display(Animator.java:144)
        at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
        at java.lang.Thread.run(Unknown Source)

"AWT-Windows" daemon prio=6 tid=0x03477400 nid=0x894 runnable [0x03e8f000..0x03e8fa14]
   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)

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

"Java2D Disposer" daemon prio=10 tid=0x02c20800 nid=0x3c0 in Object.wait() [0x03def000..0x03defb14]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x195d94b0> (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)

"Thread-0" daemon prio=6 tid=0x03434400 nid=0x768 in Object.wait() [0x0352f000..0x0352fb94]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x194f8718> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        - locked <0x194f8718> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(Unknown Source)
        at org.apache.batik.util.CleanerThread.run(Unknown Source)

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

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

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

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

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

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

"VM Thread" prio=10 tid=0x02b56400 nid=0x574 runnable

"VM Periodic Task Thread" prio=10 tid=0x02b86400 nid=0x51c waiting on condition

JNI global references: 1522

My best guess is that there’s a deadlock between the FlashThread and the AWT-EventQueue-0 thread. Instead of calling Container.remove() directly from the FlashThread, can you try using EventQueue.invokeAndWait() or EventQueue.invokeLater() to move that work on to the Event Dispatch Thread?

yes, thanks Ken!

EventQueue.invokeLater() that did it! now the program correctly quits!

thanks a lot Ken, we would have never figured that out ourselves! :slight_smile: