Friday, January 4, 2019

jcmd GC.heap_dump File exists

The instructions here https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html say:

Create a heap dump (hprof dump)

jcmd GC.heap_dump filename=Myheapdump


This is wrong. First, you need a PID; second, you should not provide filename=bla but simply bla:


Correct example:

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump /u01/users/admrun/nexus3_02.hprof


if you run simply

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump filename=bla.hprof

it doesn't create a bla.hprof but rather a "filename" file.... and the second time you run it you get a "File exists" message.

Confusing and frustrating!


No comments: