Where and when hs_err_pid.log file is formed

You are here : Home / Core Java Tutorials /

1) Where is hs_err_pid.log file formed?
By default system creates hs_err_pid.log file in the working directory of the process.

2) Where is hs_err_pid.log formed if in case file it’s not created in working directory because of some error like, may be we are running out of space or some permission issue?
In such cases the file is created in the tmp (temporary) directory of the operating system.

3) When is hs_err_pid.log formed ?
  • In case of server crash, like tomcat server crashes.
  • In case when JVM crashes.

4) When is hs_err_pid.log NOT formed ?
  • When we exit JVM in case of some unhandled exception, it’s not crashed.

5) As per oracle docs on hs_err_pid.log file>
“If the -XX:ErrorFile= file flag is not specified, the system attempts to create the file in the working directory of the process. In the event that the file cannot be created in the working directory (insufficient space, permission problem, or other issue), the file is created in the temporary directory for the operating system”.

6) Let’s analyze and Understanding contents of hs_err_pid.log file

Contents of file are very much self explanatory, let's take a quick look at them >

  • Thread :
Details of thread was running last when jvm crashed.

  • siginfo:
It gives exception code info and address at which it was there when exception occured.

  • VM state:
This gives information of VM state.

  • VM Mutex/Monitor currently owned by a thread:
It tells  about JVM internal locks.

  • System:
It gives System information

  • VM Arguments:
All the JVM arguments passed at runtime.

  • Environment Variables:
Details of java environment variables, java version used.

  • CPU:
It provides CPU details with memory information.

  • Memory:
Give memory details that was free during program execution.

  • vm_info: virtual machine information.

  • We can also get info about :
Registers, Top of Stack, Instructions, Stack info, pid (processId) - Process info, Java frames, Dynamic libraries used.

Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


Improve Locking performance in java 9

JVM logging system in Java 9 - Levels, tags, output, rotation, decoration

varHandle (variable handle) in java 9

Labels: Core Java
Must read for you :