It's all about the answers!

Ask a question

Is it possible to customize the java core and heap dump paths for Tomcat?


1
1
Alex Fitzpatrick (5583816) | asked Apr 04 '14, 2:30 p.m.
JAZZ DEVELOPER
I've been trying to diagnose a memory issue with a CLM on Tomcat install using a small VMWare image but the heap and core dumps keep filling the root file system.

While I'm unable to re-size that volume, I could add a second volume and use that for the heap dumps but I don't see how to redirect the output.

Is there some command line arguments I could add that would allow us to use a custom path?

Accepted answer


permanent link
Benjamin Silverman (4.1k610) | answered Apr 04 '14, 3:06 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can use -Xdump which is documented a fair amount in this article.  I added the settings below to my Tomcat server.startup script and now all Java dumps are being written in /dumps with their associated timestamp/PID appended to the file name.

JAVA_OPTS="$JAVA_OPTS -Xdump:heap:label=/dumps/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd"
JAVA_OPTS="$JAVA_OPTS -Xdump:java:label=/dumps/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt"
JAVA_OPTS="$JAVA_OPTS -Xdump:system:label=/dumps/core.%Y%m%d.%H%M%S.%pid.%seq.dmp"
JAVA_OPTS="$JAVA_OPTS -Xdump:snap:label=/dumps/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc"
(Optional) JAVA_OPTS="$JAVA_OPTS -Xdump:what"

You can also add the -Xdump:what option above to the Java options to print details in the standard output log when the server starts up.  You'll see this in the log:

Registered dump agents
----------------------
-Xdump:system:
    events=gpf+user+abort+traceassert,
    label=/dumps/core.%Y%m%d.%H%M%S.%pid.%seq.dmp,
    range=1..0,
    priority=999,
    request=serial
----------------------
-Xdump:heap:
    events=gpf+user,
    label=/dumps/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd,
    range=1..0,
    priority=500,
    request=exclusive+compact+prepwalk,
    opts=PHD
----------------------
-Xdump:heap:
    events=systhrow,
    filter=java/lang/OutOfMemoryError,
    label=/dumps/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd,
    range=1..4,
    priority=500,
    request=exclusive+compact+prepwalk,
    opts=PHD
----------------------
-Xdump:java:
    events=gpf+user+abort+traceassert,
    label=/dumps/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt,
    range=1..0,
    priority=400,
    request=exclusive+preempt
----------------------
-Xdump:java:
    events=systhrow,
    filter=java/lang/OutOfMemoryError,
    label=/dumps/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt,
   range=1..4,
    priority=400,
    request=exclusive+preempt
----------------------
-Xdump:snap:
    events=gpf+user+abort+traceassert,
    label=/dumps/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc,
    range=1..0,
    priority=300,
    request=serial
----------------------
-Xdump:snap:
    events=systhrow,
    filter=java/lang/OutOfMemoryError,
    label=/dumps/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc,
    range=1..4,
    priority=300,
    request=serial
----------------------

Alex Fitzpatrick selected this answer as the correct answer

One other answer



permanent link
Robert Carter (42928790) | answered Apr 04 '14, 2:53 p.m.
edited Apr 04 '14, 3:08 p.m.
 Alex,

These options maybe available in the IBM JAVA version.  Here is a link to the Oracle version, Java Debug Options.  You would have to modify the startup script to include these options.

*** UPDATE ***
Here is a link that talks about IBM specific options.  Looks like environment variables have to be set not JRE options.

*** UPDATE 2 ***
Here is some IBM support information: IBM Support Doc
To specify the Heap Dump path, add -XX:HeapDumpPath=<path> to the parameters (i.e. - -XX:HeapDumpPath=./java_pid.hprof)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.