Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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?

1

1 vote


Accepted answer

Permanent link
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

5 votes


One other answer

Permanent link
 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)

1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 04 '14, 2:30 p.m.

Question was seen: 22,700 times

Last updated: Apr 04 '14, 3:08 p.m.

Confirmation Cancel Confirm