[3.1 Alpha] Project is not closing correctly

No, at the moment I have no extra threads in project (next to the jme defaults). That’s the output in jme 3.0. Seems like the Thread-0 is missing (output is right before closing the project):

Thread[Java2D Disposer,10,system]=[Ljava.lang.StackTraceElement;@7591d762 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
sun.java2d.Disposer.run(Disposer.java:145)
java.lang.Thread.run(Thread.java:744)

Thread[Thread-4,5,main]=[Ljava.lang.StackTraceElement;@39d39f3b is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
com.jme3.util.BufferUtils$ClearReferences.run(BufferUtils.java:1372)

Thread[DestroyJavaVM,5,main]=[Ljava.lang.StackTraceElement;@747af825 is daemon = false

Thread[D3D Screen Updater,7,system]=[Ljava.lang.StackTraceElement;@353980e1 is daemon = true
java.lang.Object.wait(Native Method)
sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:436)
java.lang.Thread.run(Thread.java:744)

Thread[Attach Listener,5,system]=[Ljava.lang.StackTraceElement;@523c4f13 is daemon = true

Thread[jME3 Audio Thread,6,main]=[Ljava.lang.StackTraceElement;@756b9292 is daemon = true
java.lang.Thread.sleep(Native Method)
com.jme3.audio.lwjgl.LwjglAudioRenderer.run(LwjglAudioRenderer.java:124)
java.lang.Thread.run(Thread.java:744)

Thread[Signal Dispatcher,9,system]=[Ljava.lang.StackTraceElement;@6963eb77 is daemon = true

Thread[Reference Handler,10,system]=[Ljava.lang.StackTraceElement;@1ef807af is daemon = true
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:503)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)

Thread[TimerQueue,5,system]=[Ljava.lang.StackTraceElement;@2dc0820b is daemon = true
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.DelayQueue.take(DelayQueue.java:209)
javax.swing.TimerQueue.run(TimerQueue.java:171)
java.lang.Thread.run(Thread.java:744)

Thread[AWT-Windows,6,main]=[Ljava.lang.StackTraceElement;@3999b7a4 is daemon = true
sun.awt.windows.WToolkit.eventLoop(Native Method)
sun.awt.windows.WToolkit.run(WToolkit.java:299)
java.lang.Thread.run(Thread.java:744)

Thread[LWJGL Renderer Thread,5,main]=[Ljava.lang.StackTraceElement;@1ae78d87 is daemon = false
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1639)
Main.GameManager.getThread2(GameManager.java:95)
Main.GameManager.quit(GameManager.java:90)
GUI._ESC._POPUP.PopupExit.internalMethod(PopupExit.java:51)
GUI._ESC.ESCPopupController.popupControl(ESCPopupController.java:63)
GUI._ESC.ESCMainScreenController.windowControl(ESCMainScreenController.java:88)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
de.lessvoid.nifty.NiftyMethodInvoker.callMethod(NiftyMethodInvoker.java:145)
de.lessvoid.nifty.NiftyMethodInvoker.performInvoke(NiftyMethodInvoker.java:91)
de.lessvoid.nifty.Nifty$DelayedMethodInvoke.perform(Nifty.java:1174)
de.lessvoid.nifty.Nifty.invokeMethods(Nifty.java:1152)
de.lessvoid.nifty.Nifty.handleDynamicElements(Nifty.java:354)
de.lessvoid.nifty.Nifty.access$1700(Nifty.java:77)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1374)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1329)
com.jme3.niftygui.InputSystemJme.handleMouseEvent(InputSystemJme.java:124)
com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(InputSystemJme.java:232)
com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:296)
de.lessvoid.nifty.Nifty.update(Nifty.java:288)
com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:113)
com.jme3.input.InputManager.processQueue(InputManager.java:819)
com.jme3.input.InputManager.update(InputManager.java:883)
com.jme3.app.Application.update(Application.java:604)
com.jme3.app.SimpleApplication.update(SimpleApplication.java:231)
com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
java.lang.Thread.run(Thread.java:744)

Thread[Finalizer,8,system]=[Ljava.lang.StackTraceElement;@57fca7dd is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189)

I cannot really see how the memory tracking could cause this, especially since the finalizer is doing the exact same thing.

So if you never every enable the tracking it still does not terminate?
Cause in that case the thread should not exist at all.
(Maybee it is a good idea to give that thread a name)

Can you put a breakpoint at the constructor of this thread, to make 100% sure that it is not started if you have the tracking disabled?

Yes, I have disabled the tracking and the thread is still there. In my last post I wrote done down the threads of jme 3.0 and there no trace of this specific thread. Bacause I haven’t started this thread, I have no clue where to set the breakpoint neither how to rename it.

Which is the output of 3.0 and which is the output of 3.1… you will have to be super super super clear on this as 3.0 output is nearly useless to solve hanging problems in 3.1.

You cannot easily rename it, that was more for myself.

But you can open the Bufferutils class and search for the constructor of ClearReferences to see if it does get called. Maybee the problem is actually another thread and it just appears like this.

That’s the output of JME 3.0:

Thread[Java2D Disposer,10,system]=[Ljava.lang.StackTraceElement;@7591d762 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
sun.java2d.Disposer.run(Disposer.java:145)
java.lang.Thread.run(Thread.java:744)

Thread[Thread-4,5,main]=[Ljava.lang.StackTraceElement;@39d39f3b is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
com.jme3.util.BufferUtils$ClearReferences.run(BufferUtils.java:1372)

Thread[DestroyJavaVM,5,main]=[Ljava.lang.StackTraceElement;@747af825 is daemon = false

Thread[D3D Screen Updater,7,system]=[Ljava.lang.StackTraceElement;@353980e1 is daemon = true
java.lang.Object.wait(Native Method)
sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:436)
java.lang.Thread.run(Thread.java:744)

Thread[Attach Listener,5,system]=[Ljava.lang.StackTraceElement;@523c4f13 is daemon = true

Thread[jME3 Audio Thread,6,main]=[Ljava.lang.StackTraceElement;@756b9292 is daemon = true
java.lang.Thread.sleep(Native Method)
com.jme3.audio.lwjgl.LwjglAudioRenderer.run(LwjglAudioRenderer.java:124)
java.lang.Thread.run(Thread.java:744)

Thread[Signal Dispatcher,9,system]=[Ljava.lang.StackTraceElement;@6963eb77 is daemon = true

Thread[Reference Handler,10,system]=[Ljava.lang.StackTraceElement;@1ef807af is daemon = true
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:503)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)

Thread[TimerQueue,5,system]=[Ljava.lang.StackTraceElement;@2dc0820b is daemon = true
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
java.util.concurrent.DelayQueue.take(DelayQueue.java:209)
javax.swing.TimerQueue.run(TimerQueue.java:171)
java.lang.Thread.run(Thread.java:744)

Thread[AWT-Windows,6,main]=[Ljava.lang.StackTraceElement;@3999b7a4 is daemon = true
sun.awt.windows.WToolkit.eventLoop(Native Method)
sun.awt.windows.WToolkit.run(WToolkit.java:299)
java.lang.Thread.run(Thread.java:744)

Thread[LWJGL Renderer Thread,5,main]=[Ljava.lang.StackTraceElement;@1ae78d87 is daemon = false
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1639)
Main.GameManager.getThread2(GameManager.java:95)
Main.GameManager.quit(GameManager.java:90)
GUI._ESC._POPUP.PopupExit.internalMethod(PopupExit.java:51)
GUI._ESC.ESCPopupController.popupControl(ESCPopupController.java:63)
GUI._ESC.ESCMainScreenController.windowControl(ESCMainScreenController.java:88)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
de.lessvoid.nifty.NiftyMethodInvoker.callMethod(NiftyMethodInvoker.java:145)
de.lessvoid.nifty.NiftyMethodInvoker.performInvoke(NiftyMethodInvoker.java:91)
de.lessvoid.nifty.Nifty$DelayedMethodInvoke.perform(Nifty.java:1174)
de.lessvoid.nifty.Nifty.invokeMethods(Nifty.java:1152)
de.lessvoid.nifty.Nifty.handleDynamicElements(Nifty.java:354)
de.lessvoid.nifty.Nifty.access$1700(Nifty.java:77)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1374)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1329)
com.jme3.niftygui.InputSystemJme.handleMouseEvent(InputSystemJme.java:124)
com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(InputSystemJme.java:232)
com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:296)
de.lessvoid.nifty.Nifty.update(Nifty.java:288)
com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:113)
com.jme3.input.InputManager.processQueue(InputManager.java:819)
com.jme3.input.InputManager.update(InputManager.java:883)
com.jme3.app.Application.update(Application.java:604)
com.jme3.app.SimpleApplication.update(SimpleApplication.java:231)
com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
java.lang.Thread.run(Thread.java:744)

Thread[Finalizer,8,system]=[Ljava.lang.StackTraceElement;@57fca7dd is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189)

And here’s the output of JME 3.1:

Thread[LWJGL Timer,5,main]=[Ljava.lang.StackTraceElement;@45f27ee2 is daemon = true
java.lang.Thread.sleep(Native Method)
org.lwjgl.opengl.Sync$1.run(Sync.java:116)
java.lang.Thread.run(Thread.java:745)

Thread[DestroyJavaVM,5,main]=[Ljava.lang.StackTraceElement;@7216c66e is daemon = false

Thread[D3D Screen Updater,7,system]=[Ljava.lang.StackTraceElement;@4cf55566 is daemon = true
java.lang.Object.wait(Native Method)
sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:423)
java.lang.Thread.run(Thread.java:745)

Thread[Timer-0,5,main]=[Ljava.lang.StackTraceElement;@14bab42a is daemon = false
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)

Thread[Reference Handler,10,system]=[Ljava.lang.StackTraceElement;@42e9dd31 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:157)

Thread[TimerQueue,5,system]=[Ljava.lang.StackTraceElement;@60846b4 is daemon = true
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
   java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.DelayQueue.take(DelayQueue.java:211)
javax.swing.TimerQueue.run(TimerQueue.java:171)
java.lang.Thread.run(Thread.java:745)

Thread[Signal Dispatcher,9,system]=[Ljava.lang.StackTraceElement;@60b06d76 is daemon = true

Thread[jME3 Audio Decoder,6,main]=[Ljava.lang.StackTraceElement;@216a9eae is daemon = true
java.lang.Thread.sleep(Native Method)
com.jme3.audio.openal.ALAudioRenderer.run(ALAudioRenderer.java:255)
java.lang.Thread.run(Thread.java:745)

Thread[Java2D Disposer,10,system]=[Ljava.lang.StackTraceElement;@2d66dfe7 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
sun.java2d.Disposer.run(Disposer.java:148)
java.lang.Thread.run(Thread.java:745)

Thread[jME3 Main,5,main]=[Ljava.lang.StackTraceElement;@699f1119 is daemon = false
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1603)
Main.GameManager.getThread2(GameManager.java:111)
Main.GameManager.quit(GameManager.java:95)
GUI._ESC._POPUP.PopupExit.internalMethod(PopupExit.java:51)
GUI._ESC.ESCPopupController.popupControl(ESCPopupController.java:63)
GUI._ESC.ESCMainScreenController.windowControl(ESCMainScreenController.java:88)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
de.lessvoid.nifty.NiftyMethodInvoker.callMethod(NiftyMethodInvoker.java:157)
de.lessvoid.nifty.NiftyMethodInvoker.performInvoke(NiftyMethodInvoker.java:102)
de.lessvoid.nifty.Nifty$DelayedMethodInvoke.perform(Nifty.java:1465)
de.lessvoid.nifty.Nifty.invokeMethods(Nifty.java:1441)
de.lessvoid.nifty.Nifty.handleDynamicElements(Nifty.java:434)
de.lessvoid.nifty.Nifty.access$1600(Nifty.java:85)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1711)
de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1649)
com.jme3.niftygui.InputSystemJme.handleMouseEvent(InputSystemJme.java:123)
com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(InputSystemJme.java:231)
com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:295)
de.lessvoid.nifty.Nifty.update(Nifty.java:363)
com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:112)
com.jme3.input.InputManager.processQueue(InputManager.java:844)
com.jme3.input.InputManager.update(InputManager.java:908)
com.jme3.app.Application.update(Application.java:690)
com.jme3.app.SimpleApplication.update(SimpleApplication.java:234)
com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:152)
com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:192)
com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:233)
java.lang.Thread.run(Thread.java:745)

Thread[Finalizer,8,system]=[Ljava.lang.StackTraceElement;@aa71a81 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

Thread[AWT-Windows,6,system]=[Ljava.lang.StackTraceElement;@7fcd7a95 is daemon = true
sun.awt.windows.WToolkit.eventLoop(Native Method)
sun.awt.windows.WToolkit.run(WToolkit.java:306)
java.lang.Thread.run(Thread.java:745)

Thread[Attach Listener,5,system]=[Ljava.lang.StackTraceElement;@64cf0b6c is daemon = true

As far as I can see is that the ClearReferences should only be called/created if I have called BufferUtils.setTrackDirectMemoryEnabled(true). I have uncomment this and still getting the “not-closing”-behaviour. On top of this, the created thread of ClearReferences should have “daemon = true” that the thread-0 doesn’t have.

private static class ClearReferences extends Thread {

    ClearReferences() {
        this.setDaemon(true);
    }

    @Override
    public void run() {
        try {
            while (true) {
                Reference<? extends Buffer> toclean = BufferUtils.removeCollected.remove();
                BufferUtils.trackedBuffers.remove(toclean);
            }

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

You could try to add a breakpont at the constructor of Thread.
That way you should see all threads ever constructed and where they come from.
Now you only have to wait for one who gets assigned that name and follow the stacktrace back.

Where do these classes come from? I don’t remember ever seeing them before.

One problem with the current approach to tracking this issue is that if the hang is happening on the main thread but after you do your thread dump, then we won’t see it.

If you run your app from the command line (where you can see all of the stdout output) then you can hit ctrl-break (on Windows) to have it dump the stack traces of all threads. It will also show you deadlocks and stuff like that… but it will definitely show you exactly where your application is hanging. If you are on Linux then there’s a SIG you can send to do the same thing but I don’t remember what it is.

Else, somehow get the debugger to show you this information once the app is hanging.

The output of 3.1 is right after calling simpleApplication.stop(), means that’s the point when the application starts hanging. If I am back home, I will give it a try in case of ctrl-break to get the deadlocks.

That’s my own class which is shown if the user wants to exit (do you really want to exit? → yes, no).

No, it’s hanging after you dump the threads… or you wouldn’t see the thread dump. Thus, we cannot see where it is actually hanging because you wouldn’t be able to run code there… because it wouldn’t be hanging before that code.

Get it?

This means that there is a bunch of code we can’t see… so that makes stack traces of the actual hanging app even more important.

Another simple test would be to setup a key that calls stop() directly without going through your GUI or anything and see if the app still hangs in that case.

Well I could use the “x” of the application frame. Is jme also working with the window listener (like awt/swing) or does this work differently?

If this is true then why is your GUI code in the stack trace?

In the latest output I used the GUI to exit. I can create a new output later without the gui, but I have to look into how to create a window listener. :wink:

Or just use the jme debug controls for this case, escape will call application.stop()

Here’s the output without GUI:

Thread[Java2D Disposer,10,system]=[Ljava.lang.StackTraceElement;@465bbb36 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
sun.java2d.Disposer.run(Disposer.java:148)
java.lang.Thread.run(Thread.java:745)

Thread[Signal Dispatcher,9,system]=[Ljava.lang.StackTraceElement;@424496ba is daemon = true

Thread[jME3 Audio Decoder,6,main]=[Ljava.lang.StackTraceElement;@253d788 is daemon = true
java.lang.Thread.sleep(Native Method)
com.jme3.audio.openal.ALAudioRenderer.run(ALAudioRenderer.java:255)
java.lang.Thread.run(Thread.java:745)

Thread[D3D Screen Updater,7,system]=[Ljava.lang.StackTraceElement;@2b295189 is daemon = true
java.lang.Object.wait(Native Method)
sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScreenUpdateManager.java:423)
java.lang.Thread.run(Thread.java:745)

Thread[Attach Listener,5,system]=[Ljava.lang.StackTraceElement;@30b0cdd1 is daemon = true

Thread[AWT-Windows,6,system]=[Ljava.lang.StackTraceElement;@56a76c3b is daemon = true
sun.awt.windows.WToolkit.eventLoop(Native Method)
sun.awt.windows.WToolkit.run(WToolkit.java:306)
java.lang.Thread.run(Thread.java:745)

Thread[TimerQueue,5,system]=[Ljava.lang.StackTraceElement;@4a541ef0 is daemon = true
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.DelayQueue.take(DelayQueue.java:211)
javax.swing.TimerQueue.run(TimerQueue.java:171)
java.lang.Thread.run(Thread.java:745)

Thread[LWJGL Timer,5,main]=[Ljava.lang.StackTraceElement;@2b10ab2a is daemon = true
java.lang.Thread.sleep(Native Method)
org.lwjgl.opengl.Sync$1.run(Sync.java:116)
java.lang.Thread.run(Thread.java:745)

Thread[Timer-0,5,main]=[Ljava.lang.StackTraceElement;@1df825dc is daemon = false
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)

Thread[Finalizer,8,system]=[Ljava.lang.StackTraceElement;@705344ec is daemon = true
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

Thread[Reference Handler,10,system]=[Ljava.lang.StackTraceElement;@1a1a6788 is daemon = true
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
java.lang.ref.Reference$ReferenceHandler.run(Reference.java:157)

Thread[DestroyJavaVM,5,main]=[Ljava.lang.StackTraceElement;@347dd61a is daemon = false

Thread[jME3 Main,5,main]=[Ljava.lang.StackTraceElement;@68f7c38c is daemon = false
java.lang.Thread.dumpThreads(Native Method)
java.lang.Thread.getAllStackTraces(Thread.java:1603)
Main.GameManager.getThread2(GameManager.java:121)
Main.GameManager.requestClose(GameManager.java:85)
com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:219)
java.lang.Thread.run(Thread.java:745)

Maybe I’ve got an idea what could cause this problem. When I was trying to close the application via ‘Finish Debugger Session’, I’ve got the following message:

AL lib: (EE) alc_cleanup: 1 device not closed

The last bit is unrelated.

And again… I can’t stress enough that the hanging happens AFTER your thread dump. As in the thread dump is going to be 10000000% useless for solving this problem.

The problem is, according to the debugger, my application is not hanging at all - well it seems like. If I call “Check for deadlocks” it says that there are no deadlocks. Of course I call the option after closing the window (at the point it should hanging)

Just to make sure I understood you right, do I have to use the debugger thread control and suspend all active threads to see the core problem? If yes, what about the following?:

I also tried to use the crtl+break but didn’t get anything. That’s my first time I’ve trying to get used of the debugger, so I am sorry if I still didn’t get the right way.

You need to be able to show us the stack trace of the hanging program. Of the 1,312,246,262 ways that a program can ‘hang’… a ‘deadlock’ is only one of those and is likely not happening here. For example, something could be throwing an exception that is caught and swallowed but otherwise doesn’t kill the non-daemon thread so it loops forever.

Do you run windows? How did you try it? What did your “Command Prompt” command look like? Should have been something like:
java -jar dist\YourAppsJar.jar

Then in that command line window when the app is hanging, hold the ctrl key and press the “Break” key. (Not ctrl-c but ctrl Break)

It should dump the stack trace of all of the threads.