JVM Crash

A Crash is a situation when the JVM encounters a fatal error such as a segmentation fault and is unable to continue functioning.

Start your free trial

How Plumbr will help you

When a JVM crashes, Plumbr captures the crash log and exposes its contents to you. The crash log itself contains all the information about the state of the JVM at the time of the crash. It includes the general information about the JVM and the crash as seen above, the state of the thread that originated the crash.

The example below exposes the thread name, signal information, the contents of the registers at the time of the crash, and the data on the stack. Also included, but not shown here, are the machine instructions. All of this information is very useful in figuring out exactly what the program was doing that triggered the crash.

Current thread (0x00007f4a93166800):  JavaThread "Hikari connection adder (pool HikariPool-0)"
daemon [_thread_in_Java, id=19899, stack(0x00007f4a78ee5000,0x00007f4a78fe6000)]

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000019

Registers:
RAX=0x0000000000000003, RBX=0x0000000000000003, RCX=0x00000007afc30404, RDX=0x0000000793782188
RSP=0x00007f4a78fe4230, RBP=0x00000000ee1412d9, RSI=0x00000000dc9bfd29, RDI=0x0000000003ae903b
R8 =0x00000007afc2c308, R9 =0x000000000000103b, R10=0x0000000000000003, R11=0x0000000000004000
R12=0x0000000000000000, R13=0x00000007c0034ff0, R14=0x0000000770a096c8, R15=0x00007f4a93166800
RIP=0x00007f4afda03383, EFLAGS=0x0000000000010202, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007f4a78fe4230)
0x00007f4a78fe4230:   00000000f5f85861 0000000793782188
.......................................................
Register to memory mapping:
RCX=0x00000007afc30404 is pointing into object: 0x00000007afc2c308
[Ljava.util.concurrent.ConcurrentHashMap$Node;
 - klass: 'java/util/concurrent/ConcurrentHashMap$Node'[]
 - length: 16384

The Solution

There is no silver bullet for addressing JVM crashes, but here are some approaches. The easiest case would be if the failure originated from native code invoked via JNI, and it indeed is one of the more common occurrences. There is some documentation on this subject that could help interpret the crash log.

In other cases this may be triggered by a bug in the JVM itself, so oftentimes simply upgrading the JDK to the latest version may resolve the issue. If even that does not help, then some heavy-duty work like debugging the JVM may be needed. There are some great instructions online, such as this conference talk.

Start your free trial