javasegmentation-faultcentos7jvm-crashjnienv

JVM crash on Centos7


I am running a jetty server on centos7 and it keeps crashing with the below error

 # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007fdd323ee698, pid=79411, tid=0x00007fd05bdfd700
    #
    # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-8u222-b10-1~14.04-b10)
    # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode linux-amd64 )
    # Problematic frame:
    # V  [libjvm.so+0x653698]
    #
    # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
    #
    # If you would like to submit a bug report, please visit:
    #   http://bugreport.java.com/bugreport/crash.jsp
    #

    ---------------  T H R E A D  ---------------

    Current thread (0x00007fd044001800):  JavaThread "cron4j::scheduler[875ca3d006f7a65e29bf90fc0000016fc6274c4c6286cd54]::executor[875ca3d006f7a65e293583000000016fc678c0816e4418c5]" [_thread_in_vm, id=93353, stack(0x00007fd05bcfd000,0x00007fd05bdfe000)]

    siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000
Stack: [0x00007fd05bcfd000,0x00007fd05bdfe000],  sp=0x00007fd05bdfc4b0,  free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x653698]
C  [libbCacheService.so+0x2068c]  JNIEnv_::GetObjectClass(_jobject*)+0x2e
C  [libbCacheService.so+0x1f400]  Java_com_applictaion_test_CacheService_buildCache+0x111
j  com.application.test.CacheService.buildCache([Lcom/application/test/db/CacheJNI;)V+0

The same code works fine on ubuntu. However, it keeps failing on Centos 7.

I have

gcc --version
gcc (GCC) 9.2.0
java-1.8.0-openjdk-amd64 and jre1.8.0_65 same issue with both the JRE versions
Further more I use -XX:+UseParallelGC for GC.

As one can see the issue is from libjvm.so JVM environment and not an application problem. Besides, the same setup and code on Ubuntu works fine, any idea what is going on with Centos 7?

Thanks

Raj


Solution

  • As one can see the issue is from libjvm.so JVM environment and not an application problem

    No: the issue is most likely with libbCacheService.so, and not libjvm.so. I don't know what the origin of libbCacheService.so is, but given that google only finds this question when I search for it, I suspect that it's your application.

    Besides, the same setup and code on Ubuntu works fine

    That is quite often the case: an application exhibiting undefined behavior works "fine" on one system, and crashes on another.

    Your first step should be building libbCacheService.so with debug info, enabling core dumps, and checking from the core that whatever libjvm.so function is invoked from JNIEnv_::GetObjectClass() is called with correct arguments.

    P.S. It looks (from si_addr) that libjvm.so dereferenced a NULL pointer. Possibly because you passed a NULL pointer to it as one of the parameters.