Bug 1049

Summary: Application Crashes when System.exit() is Called within JOGL callbacks.
Product: [JogAmp] Jogl Reporter: ray <h.k.ghost>
Component: openglAssignee: Sven Gothel <sgothel>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: linux   
URL: http://forum.jogamp.org/Need-Help-Solving-OpenGL-GLSL-4-4-Issues-td4032557i20.html#a4032887
Type: --- SCM Refs:
Workaround: ---
Attachments: Output of JStack command on application

Description ray 2014-08-22 10:53:42 CEST
Created attachment 623 [details]
Output of JStack command on application

When an application executes a System.exit() while inside a JOGL-specific overriden callback (e.g. init(GLAutoDrawable), or display(GLAutoDrawable), etc) the application crashes and even fails to terminate.
When the System.exit() call is made within the overriden JOGL methods, instead of terminating it will crash and hang. The only way to terminate the application at that point is to send it the -SIGKILL signal

I noticed this behavior in the March 2014 release and it's also present in the more recent August 2014 release (v2.2.0).

I've attached the output of jstack for an application showing the symptoms. It was suggested[1] that I try GLProfile.shutdown() prior to System.exit(), but that made no noticeable difference.

A simple way to reproduce the problem is to create a basic application and add the following code:

@override
public void init(GLAutoDrawable auto) {
    // adding/removing the GLProfile line makes no visible difference
    GLProfile.shutdown();
    System.exit(0);
}

It seems exiting under any of the JOGL methods/callbacks, (e.g. display(GLAutoDrawable)) will reliably reproduce the problem. I tested on both init and display methods.

[1] http://forum.jogamp.org/Need-Help-Solving-OpenGL-GLSL-4-4-Issues-td4032557i20.html#a4032887