Posted by
huy1912 on
Jul 26, 2016; 10:01am
URL: https://forum.jogamp.org/JVM-Crash-with-SIGSEGV-tp4036967.html
While testing the ShutdownHook for the SIGTERM, got below JVM crash
#0 0xb7fe87a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0xb7eb2825 in raise () from /lib/tls/libc.so.6
#2 0xb7eb4289 in abort () from /lib/tls/libc.so.6
#3 0xb78421ff in os::abort () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#4 0xb798aa87 in VMError::report_and_die () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#5 0xb798b651 in crash_handler () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#6 <signal handler called>
#7 0xb75e46f9 in GenCollectedHeap::is_in () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#8 0xb783f401 in os::print_location () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#9 0xb784a078 in os::print_register_info () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#10 0xb798a08b in VMError::report () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#11 0xb798a990 in VMError::report_and_die () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#12 0xb784951c in JVM_handle_linux_signal () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#13 0xb78451e4 in signalHandler () from /usr/java/jdk1.6.0_43/jre/lib/i386/server/libjvm.so
#14
<signal handler called>#15 0x535ad1f9 in
glXChooseVisual () from /usr/lib/libGL.so.1
#16 0x0ce3b3c8 in ?? ()
#17 0x00000000 in ?? ()
Note: Unable to to systematically reproduce the JVM crash, but saw the coredump once during testing.
- System Overview
The system is having multiple dialogues which display the drawing data on GLCanvas by using JOGL 2.1.3. Each GLCanvas is using its own animation thread to draw its own data. During drawing, each animation thread will create deep clone data provided by data thread in order to avoid the concurrent issue.
The VM arguments for the java process: -Djogl.1thread=false Djogamp.common.utils.locks.Lock.timeout=10000
- Shutdown requirement
When the system receives the SIGTERM signal, the ShutdownHook is used to clean up the services related to data and terminate the running JVM (System.exit(0)). This is to ensure that there is no resource leak on the server side.
- Issue
JVM crash occurred after invoking the above JVM termination (System.exit(0)).
- Analysis
It's likely that some pending animation threads were still running even though System.exit(0).
I couldn't figure out why the glXChooseVisual gets invoked.
Inspected from JOGL implementation and found that the glXChooseVisual gets invoked via the X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationXVisual which is invoked by GLCanvas.chooseGraphicsConfiguration when the GLCanvas is added to the container.
Below is the sequence diagram

So this assumption is not correct as there was no GLCanvas added to the Container.
Couldn't find the native code to find out why the glXChooseVisual gets invoked with the
<signal handler called>. I did check on the NativeWindowFactory where is listening to the ShutdownHook event, but it doesn't result in calling the glXChooseVisual.
I deeply appreciate if someone can shed a light on this as need to provide the analysis for the crash.