In most cases, we get the diagnostic logs like javacores/coredumps when Java application crashes due to segmentation fault, stackoverflow error etc. However, in certain circumstances, we don’t get any diagnostic logs/information when the Java application crashes or abruptly terminates.
The causes for these problems could vary with different applications. Some of the causes could be:
- The application code has a call to “System.exit”, which could cause the JVM to terminate abruptly and can mislead the user to think that the JVM crashed without any diagnostic logs.
- Sometimes we may not get the logs if the application crashes, while executing some low level assembly code.
- The application crashes during VM startup or shutdown at which stage the RAS capabilities don’t exist to automatically generate the diagnostic logs.
usually turn out to be hard nuts to crack especially if the problem occurs only
in the production environment. In this
blog, I have tried to outline some of the debugging techniques that we have
used to debug such problems on Windows operating systems and we were able to
get the diagnostic information. These
techniques are applicable for problems where we have local re-create and/or
problems that are seen only in the production environment.
1. Enable VM to generate javacore/coredumps when VMSTOP event occurs using –Xdump option as follows:
2. Enable VM to generate javacore when System.exit is called by the application using –Xtrace as follows:
3. Disable VM from handling the signals using –Xrs (reduced signal handling) command line option. This causes the underlying OS to handle the signals. Along with this, ensure that the OS is configured to generate the dumps when an application crashes.
Automatically capture dumps when a process crashes
Enable or Disable DrWatson on Windows
4. Enable JNI tracing
5. Use Windbg to do live debugging of the application and collect diagnostic information such as stack trace or coredumps when the problem occurs. This will also be useful if at all any “first chance” access violation problem leads to application crash.
Debugging a User-Mode Process Using WinDbg
6. Use the ADPlus utility to collect the diagnostic information when JVM crashes
ADPlus download site:
How to use ADPlus.vbs to troubleshoot "hangs" and "crashes"