skip to content

Crash Logs & Core Dumps

When the JVM process itself dies: reading an hs_err fatal error log for the signal, the problematic frame and the thread, and when a core dump is worth capturing. What do you open first?

part ofJVM internalsread it →
on this pageshow

questions

5

In a HotSpot hs_err fatal error log, what do the signal line and the 'Problematic frame:' line tell you, including the frame's first letter?

level: middleimportance: must knowfreq 38%

answer

  1. the header before the first section
  2. signal name, number, pc
  3. one letter per frame type
  4. C versus V versus J
  5. C points at a library, not HotSpot

basics

~20 s

The signal line gives the signal, its number and the faulting pc. The problematic frame's first letter says whose code ran: C native code outside the VM, V HotSpot's own C++, v VM-generated stubs, J JIT-compiled Java, j interpreted Java.

solid answer

~50 s

The header names the failure: `SIGSEGV (0xb) at pc=…, pid=…, tid=…` is a fatal signal at that instruction address, while `Internal Error (file:line)` means a HotSpot assertion failed instead. The `Problematic frame:` line is the frame the crash happened in, and its first letter classifies it: `C` is native C/C++ outside the VM (shown as `[libname.so+offset]` and a symbol when one resolves), `V` is code inside the VM's own library, `v` is code the VM generated (stubs, adapters), `J` is a JIT-compiled Java method with its compile id and compiler, and `j` is an interpreted Java method with its bytecode index. The HotSpot source puts it plainly: a `C` frame suggests a problem in a user library, everything else is likely a VM bug. "Likely" is the right strength: the next sections, the thread and its stacks, are what confirm it.

code

console · 10 lines
console
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f3a9c41a2b4, pid=4127, tid=4242
#
# JRE version: OpenJDK Runtime Environment (25.0.4+7) (build 25.0.4+7)
# Java VM: OpenJDK 64-Bit Server VM (25.0.4+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libimgproc.so+0x1a2b4]  resize_rgb+0x54
#

go deeper

for a junior

Recall that the header names the signal and the problematic frame, and that the frame's first letter says whose code was running.

for a middle

Read each header line correctly, including the pc, the collector on the Java VM line, the five frame letters and the (sent by kill) suffix.

for a senior

Treat the frame letter as a hypothesis: explain how native heap corruption produces a V frame in a GC thread, and compare headers across several crashes.

for a principal

Make sure crash headers reach the central logs from every service, so recurring frames across a fleet are spotted without anyone fetching files by hand.

## The header is the triage summary An **hs_err fatal error log** begins with a block of lines starting with `#`. The same block is printed to standard output when the JVM dies, so it is often visible in a service's log even when the file itself is lost. Built from the JDK 25 print statements, it looks like this: ```console # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f3a9c41a2b4, pid=4127, tid=4242 # # JRE version: OpenJDK Runtime Environment (25.0.4+7) (build 25.0.4+7) # Java VM: OpenJDK 64-Bit Server VM (25.0.4+7, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # C [libimgproc.so+0x1a2b4] resize_rgb+0x54 # ``` Reading it top to bottom: 1. `A fatal error has been detected by the Java Runtime Environment:` says the error handler ran for a crash. If the first line instead reads `There is insufficient memory for the Java Runtime Environment to continue.`, this is a **native allocation failure**, not a crash, and the next line says which allocation (`malloc`, `mmap`) failed and for how many bytes. 2. The **signal line**: the signal name (`SIGSEGV`), its number in hex (`0xb` is 11), the **pc** (program counter, the address of the faulting instruction), the process id and the operating-system thread id. If the signal was delivered with `kill` rather than raised by a faulting instruction, the line adds `(sent by kill)`, which means no instruction in the process faulted. For an internal VM error this line instead reads `Internal Error (<file>:<line>)`. 3. The **version lines**: the exact JDK build and, on the `Java VM:` line, the execution mode, whether tiered compilation and compressed pointers are on, and the **collector** (`g1 gc` above). You need these to match the crash to known bugs and to reproduce it. 4. The **`Problematic frame:`** line: the frame the crashing thread was executing. ## The frame-type letters The letter comes from HotSpot's frame printer; the comment above it in the source lists the types. | Letter | Meaning | What it looks like | |---|---|---| | `C` | native C/C++ code outside the VM | `C [libimgproc.so+0x1a2b4] resize_rgb+0x54` | | `V` | C/C++ code inside the VM's own library | `V [libjvm.so+0x…] <function>+0x…` | | `v` | code the VM generated: stubs, adapters | `v ~StubRoutines::<name> 0x…` | | `J` | a JIT-compiled Java method | `J 1234 c2 <class>.<method>(<sig>) (… bytes) @ …` | | `j` | an interpreted Java method | `j <class>.<method>(<sig>)+<bci>` | The same letters appear in the stack sections further down, whose legends read `Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)` and `Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)`. ## What the letter suggests, and how strongly The source comment says that a `C` frame **suggests** the problem is in a user library and that everything else is **likely** a VM bug. Treat that as the first hypothesis, not the verdict: - A **`C` frame** in your own JNI library, or in a third-party native library, points at that code. When the crashing Java thread was in native code, the header also says `The crash happened outside the Java Virtual Machine in native code.` and `See problematic frame for where to report the bug.` - A `C` frame in the C library itself (a `memcpy`, say) still usually means the caller passed a bad pointer or length: the native stack shows who called it. - A **`V` frame** points at HotSpot, but native code that wrote past a buffer can corrupt the Java heap, and the collector then crashes later on the damaged object. A `V` frame in a GC thread is therefore not proof of a GC bug when a native library is loaded. - A **`J` frame** in a method that crashes only after it is compiled points at the JIT compiler, or at an intrinsic it used. ## What to read next The header tells you where; the **THREAD** section tells you who: the crashing thread's name and state, its native stack and its Java stack. After that, the **PROCESS** section gives the VM state (`not at safepoint`, `at safepoint`, `synchronizing`), the heap and the non-default flags, and the **SYSTEM** section the operating system, CPU and memory. Compare the header across several crash logs from the same service: the same frame every time is a deterministic bug in that code, while a different frame each time points at memory corruption that surfaces wherever the damage is touched.

  • The signal line ends with '(sent by kill)'. How does that change the investigation?
    It means the signal was delivered by another process with `kill` rather than raised by a faulting instruction, so the problematic frame is just where the thread happened to be. You stop reading the stacks for a bug and look for whoever sent the signal: an operator, a script or a supervisor.
  • Several crash logs from one service show a different problematic frame each time, some V and some C. What does that pattern suggest?
    Memory corruption rather than a single faulty function. Something, often native code writing out of bounds, damages memory, and the crash happens later wherever the damaged data is next used, including inside the collector. Look for what all the crashes share, such as a native library loaded in each, rather than at any one frame.

  • Reads any SIGSEGV as a bug in the Java application code.
  • Treats a V frame in a GC thread as proof of a collector bug.
  • Confuses the lowercase j frame with a JIT-compiled method.
  • Ignores the version line when comparing crashes across hosts.
  • Reads only the problematic frame and never the crashing thread's stacks.
open as a page

On a HotSpot JVM, what is an hs_err_pid<pid>.log file, when is one written, and where do you look for it?

level: juniorimportance: should knowfreq 32%

basics

~20 s

An hs_err_pid<pid>.log file is the fatal error log HotSpot writes when the JVM process itself crashes, for example on a SIGSEGV in native code. It lands in the working directory by default, falls back to the temp directory, and -XX:ErrorFile moves it.

open as a page

A JVM in production died three times this week with exit codes 134, 137 and 3. How do you tell a HotSpot crash from a kernel OOM kill or an ExitOnOutOfMemoryError exit?

level: seniorimportance: should knowfreq 36%

basics

~20 s

134 is SIGABRT, HotSpot aborting after a crash, with an hs_err file; 137 is SIGKILL, typically the kernel OOM killer, leaving no file but a kernel log record; 3 is -XX:+ExitOnOutOfMemoryError exiting after a 'Terminating due to java.lang.OutOfMemoryError' line.

open as a page

A JVM service that calls a native image-processing library through JNI dies several times a week with exit code 134, leaving hs_err_pid<pid>.log files. How do you establish whose bug it is?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Compare the problematic frames and crashing threads across several hs_err files. A C frame in the library with the thread in _thread_in_native points at the library or the JNI glue; a compiler thread points at the JIT; V frames in GC threads need native corruption ruled out.

open as a page

As the lead for a fleet of JVM services in containers, what crash evidence do you make every JVM keep, and do you enable core dumps in production?

level: principalimportance: nice to knowfreq 25%

basics

~20 s

Always keep the hs_err log: -XX:ErrorFile with %p on a persistent volume, or ErrorFileToStdout into central logs. Core dumps are costly and hold memory contents, so enable them per service where native crashes recur, with storage, access and retention decided first.

open as a page