J9 Java Dump Recipe
A J9 Java
Dump is a text file that includes a thread dump and other useful
information about a running Java process. A Java Dump is often called a
javacore
because its name defaults to
javacore*.txt
although javacores should not be confused
with operating system process core dumps (OS cores) which are large and
heavy.
In general, javacores have a low overhead and pause the proceess for less than a few hundred milliseconds, although there are pathological exceptions of ~20 second pauses that are potential risks to be aware of. In general, javacores are less than a few MB each although they can reach dozens of MBs if there are a lot of loaded classes.
- On non-Windows operating systems, unless default
-Xdump...events=user
settings have been changed, replace$PID
with the process ID in the following (despite the signal name "QUIT", by default, unless-Xrs
is specified, the JVM gracefully handles this signal and continues without quitting):kill -QUIT $PID
- For Semeru Java, replace
$JAVA_HOME
with the path to Java, and$PID
with the process ID in (if running under a Windows Service, use a technique to run the command as the SYSTEM user):$JAVA_HOME/bin/jcmd $PID Dump.java
- For IBM Java >= 8.0.6.25 that is a JDK, replace
$JAVA_HOME
with the path to Java, and$PID
with the process ID in (if running under a Windows Service, use a technique to run the command as the SYSTEM user):java -Xbootclasspath/a:$JAVA_HOME/lib/tools.jar openj9.tools.attach.diagnostics.tools.Jcmd $PID Dump.java
- With WebSphere Application Server traditional:
- Administrative Console } Troubleshooting } Java dumps and cores } Check the server(s) } Java core
$WEBSPHERE/bin/wsadmin -lang jython
and the commandAdminControl.invoke(AdminControl.completeObjectName("type=JVM,process=$SERVER,*"), "dumpThreads")
- On z/OS,
MODIFY $JOB,JAVACORE
- On IBM i, use
WRKJVMJOB
- Install the
twasdiag
application and execute the/IBMJavaDump
servlet.
- With WebSphere Liberty:
- Using the
server
utility:$LIBERTY/bin/server javadump $SERVER
- Install the
libertydiag
application and execute the/servlet/ThreadDump
servlet.
- Using the
- For IBM Java >= 8.0.7.20 and IBM Semeru Runtimes >= 11.0.17.0
on non-Windows platforms, restart with:
Then request the javacore with:-Xdump:java:events=user2,request=exclusive+prepwalk
kill -USR2 $PID
- For IBM Java, use Java
Surgery:
java -jar surgery.jar -pid $PID -command JavaDump
- Use code
within the JVM that executes
com.ibm.jvm.Dump.triggerDump("java:request=exclusive+prepwalk")
using reflection - The IBM Java
java
Dump Agent can take a javacore on various events. For example, the following will create a javacore when theExample.bad
method throws aNullPointerException
:-Xdump:java:events=throw,range=1..1,request=exclusive+prepwalk,filter=java/lang/NullPointerException#com/ibm/example/Example.bad
- The trace
engine may be used to request a javacore on method entry and/or
exit. The following example JVM argument produces a javacore when the
Example.trigger()
method is called:-Xtrace:maximal=mt,trigger=method{com/ibm/example/Example.trigger,javadump,,,1}