LKC
LKC

Reputation: 141

-XX:HeapDumpPath option in jvm config not working

-XX:HeapDumpPath not working when kill -3.

java -server -Xms4G -Xmx4G -XX:+UseG1GC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:{GC_PATH} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={HEAP_PATH} -jar -Dspring.profiles.active=local app.jar

gc log printed in correct {GC_PATH}. But Heapdump printed in stdout.

Is any wrong in my jvm config OR Doesn't work when kill -3 ??

Upvotes: 2

Views: 2199

Answers (1)

apangin
apangin

Reputation: 98330

HeapDumpPath affects only automatic heap dumps generated in response to one of the following options:

  • -XX:+HeapDumpOnOutOfMemoryError
  • -XX:+HeapDumpBeforeFullGC
  • -XX:+HeapDumpAfterFullGC

It has no effect on heap dumps generated by other means, e.g. jmap command or dumpHeap operation called via JMX.

Also HeapDumpPath has no effect on thread dumps. In particular, kill -3 will print thread stacks on stdout of the Java process. If you want to dump threads to the given file, use jstack.

Upvotes: 3

Related Questions