When I exit a running JOGL application in Eclipse, there's always a Java thread left behind, which I need to stop manually.
Otherwise it keeps running, consuming 100% CPU. Some of the demos handle shutdown, by stopping the Animator and calling System.exit(). I'm not using an Animator, and System.exit() still leaves something running. Any clue as to what it might be? Many thanks. |
Administrator
|
I've noticed this before on Linux (though not lately). If you run your app in debug mode, then hit the "pause" button in Eclipse instead of shutting Eclipse down, it should break all threads so you can see who's still running and where they are in the code (you might need to attach source to JOGL to see the details).
|
Administrator
|
In reply to this post by The.Scotsman
Hi
I don't reproduce this bug. I used JOGL with Eclipse RCP during about 18 months without such a trouble.
Julien Gouesse | Personal blog | Website
|
In reply to this post by Wade Walker
I tried that before posting. Just says 'javaw.exe'. Commented out stuff and isolated it to a single call: canvas = new GLCanvas(); Removing this and shutdown is clean. Added 'canvas.destroy()' to the shutdown method (inside a SwingUtilities.invokeAndWait), but it didn't help... If jogamp is not the problem, I guess that leaves Eclipse (using 3.5) and the graphics driver (Catalyst 12.4/OpenGL 6.14.10.11631). Will have to try on another PC. Thanks for all the input. |
Administrator
|
Hmm, you might try jvisualvm.exe (which comes with the Oracle JVM) to see if it gives any insight into which thread is holding the VM alive. It might be a JVM shutdown hook that stalls or something.
|
Thanks for the tip about jvisualvm.
Never seen that before - pretty cool. Unfortunately, it doesn't supply any additional information about the thread that is running. Oh well... |
Administrator
|
How about trying jstack? See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstack.html for details. I saw Sven suggest this recently, I hadn't heard of it.
|
I hadn't heard of it either. Ran it an it said it couldn't handle a 32 bit process. Strange, since JAVA_HOME points to a 64 bit JRE, and I'm building and running the app with 64 bit JDK (to go with the 64 bit jogamp natives). So I installed a 32 bit JDK, and ran jstack from there. Spit out a whole bunch of stuff, all related to Eclipse. Maybe I just need to update Eclipse (and hope all my plugins still work...) Or alternatively, uninstall all the 32 bit JRE's, and force Eclipse to use the 64 bit. Thanks for all the assistance with this. |
Administrator
|
The best way to get Eclipse to use a given JRE/JDK is to put it in the eclipse.ini file like this: http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#eclipse.ini
I've had good success using this on Linux, so it might be worth a try for you. |
In reply to this post by The.Scotsman
Hello,
I seem to have the same problem and was just wondering if you could fix it. I use Windows 7, Eclipse (version 4.2) and also a Catalyst graphics driver (version 12.8). After System.exit() was called according to the Debug-window in eclipse all Threads terminate, but javaw.exe is still running. Moreover, javaw.exe also keeps running when i export this configuration as a .jar start it and try to close it, but on a friend's computer it shuts down just fine. |
This post was updated on .
In reply to this post by Wade Walker
I found the same problem here, if I call JOGL 2.15 it does not terminate .
E.g. If I only put the below code in the main function, it will not close cleanly: GLProfile glpMinimal = GLProfile.get(GLProfile.GL2); It does not appear to be my driver as it works with LWJGL 2.9.1 Obviously when something simple is put in the main function like sys out, it also works. Did anybody resolve this?
___
|
Administrator
|
On 06/28/2014 11:24 PM, raptor [via jogamp] wrote:
> I found the same problem here, as soon as I call JOGL it does not terminate . > > E.g. If I only put the below code in main it still does not close cleanly: > /GLProfile glpMinimal = GLProfile.get(GLProfile.GL2);/ > > I thought its my driver when C calls are made but it does not appear to be the > case since it works with LWJGL 2.9.1 > > Obviously when something simple is put in the main function like sys out, it > also works. > allows the background thread to end. Yes, JOGL initialization shall bring-up a thread called 'main-SharedResourceRunner' If a NEWT window/display is open, a thread called 'main-Display-.x11_:0-1-EDT-1' should be alive. etc .. However, these threads are daemon threads _and_ shall be explicitly brought down by our JVM shutdown-hook. Even if the latter is not working, a daemon thread shall not hinder the JVM to shutdown. Maybe JOGL is running in a pre-existing JVM, hence sharing such instance and is never brought down ? I tested running single JOGL unit test and JOGL demo applications from within Eclipse and I could not see remaining JVM instances or threads. ~Sven > Did anybody resolve this? signature.asc (894 bytes) Download Attachment |
Thanks for the reply. Here are some more details for completeness:
* Eclipse: Version: Kepler Service Release 1 Build id: 20130919-0819 * Win 7 64 bit * Java 1.7.0_51 64
___
|
In reply to this post by Sven Gothel
I did some more digging and it seams the issues is when the function below in the JOGL API is called (seams some racing issue) :
jogamp.opengl.GLDrawableFactoryImpl.getOrCreateSharedResource protected final SharedResourceRunner.Resource getOrCreateSharedResource(AbstractGraphicsDevice device) { try { device = validateDevice(device); if( null != device) { return getOrCreateSharedResourceImpl( device ); } } catch (GLException gle) { if(DEBUG) { System.err.println("Catched Exception on thread "+getThreadName()); gle.printStackTrace(); } } return null; } If I replace the bold section with null, it will shutdown OK. It also could be the the manner in which the Thread is executed in the GLProfile.initSingleton withing the "AcessController.doPrivileged" clause.
___
|
This post was updated on .
In reply to this post by Sven Gothel
OK.
This does does point to JOGL being a culprit. Eclipse will not complacently exit the process if there is still an open handle. If I run the below code the same behavior is exhibited: public class HogApp { public static void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder(new String[]{"cmd","/c","start","notepad.exe"}); Process p = pb.start(); Thread.sleep(5000); //wait for 5 sec p.destroy(); } catch (Exception e) { // TODO: handle exception } } } NOTE: I also use the ATI Catalyst drivers (14.4), as sylz above. So this may mean that JOGL does not release a handle to "something" that may automatically be closed by other driver implementations. Also remember that the LWJGL does seam to explicitly release "this" handle, as the problem does not happen when using this framework.
___
|
In reply to this post by Sven Gothel
Sven, are you able to reproduce the issue when Eclipse is not exiting the Thread completely, using my HogApp?
___
|
Administrator
|
raptor, why not writing a bug report so that it doesn't get completely lost?
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by raptor
Interesting -- when I run HogApp, after 5 seconds the app terminates, and the JVM that was spawned to contain it also terminates (as seen in ProcessExplorer), but the Eclipse Debug pane doesn't show it as terminated until I manually kill Notepad, even though its JVM is definitely gone.
I don't see the same symptoms with JOGL though, at least not the version I'm using. It shuts down properly when I kill the program. I'm on Windows 7 with Nvidia drivers, Java 1.7.0_25, and Eclipse 3.8. |
Thanks for trying.
Good. This shows that , in your environment too, eclipse will not close javaw.exe if an external handle is not terminated. This is why I think JOGL is not closing a handle to a native call it's making, which it supposed to do. I think, ATI type drivers may not close this resource unless the calling thread does. Other drivers seem to be doing this “somehow”. Did you try to reproduce the issue by putting the JOGL code below into your main? public static void main(String[] args) { GLProfile glpMinimal = GLProfile.get(GLProfile.GL2); } gouessej - I will raise a bug - not sure how yet, but I will find out
___
|
Administrator
|
Actually what I'm saying is that the javaw.exe for the app is killed, but Eclipse doesn't mark the app as terminated until the external Notepad process it spawned is killed. Can you see any external process start up when you launch your JOGL app? And do you see your app's javaw.exe terminate like I do? Note that when running an app inside Eclipse, you can see two javaw.exe processes running, one for Eclipse itself, and a child javaw.exe for your app. It's the child one that dies when your app exits. |
Free forum by Nabble | Edit this page |