Ever attempted to get a hprof dump via jcmd?
Since we have removed the JVMTI agent support for HPROF in JDK9, the way to get one now is by using the command-line tool jcmd:
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump
8028:
java.lang.IllegalArgumentException: The argument 'filename' is mandatory.
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=mydump.hprof
8028:
Heap dump file created
Comment: yes thanks, but where was the file created? Since I don't know where it was created, i will attempt to direct it using an absolute path:
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=D:\mydump.hprof
8028:
File exists
Comment: Hmm, file exists? Strange, after checking, I don't have a D:\mydump.hprof file...
Will try to dump it out again, with a relative path, but with another filename
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=test.hprof
8028:
File exists
Comment: File exists again? Strange...
Inspecting the CWD from where the JVM was launched, I don't see either mydump.hprof or test.hprof there...
However, after scrutinising some file timestamps in CWD, I was able to find this file, named "filename":
2017-03-29 11:42 55,572,956 filename
It is this single "filename" file in the CWD that is causing the system to output "File exists" unconditionally, disregarding the new dump targets provided by the user (because of bug(s) that always attempt to create this "filename" target file)
Since we have removed the JVMTI agent support for HPROF in JDK9, the way to get one now is by using the command-line tool jcmd:
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump
8028:
java.lang.IllegalArgumentException: The argument 'filename' is mandatory.
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=mydump.hprof
8028:
Heap dump file created
Comment: yes thanks, but where was the file created? Since I don't know where it was created, i will attempt to direct it using an absolute path:
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=D:\mydump.hprof
8028:
File exists
Comment: Hmm, file exists? Strange, after checking, I don't have a D:\mydump.hprof file...
Will try to dump it out again, with a relative path, but with another filename
D:\devcpp\projects>%java_home%\bin\jcmd 8028 GC.heap_dump filename=test.hprof
8028:
File exists
Comment: File exists again? Strange...
Inspecting the CWD from where the JVM was launched, I don't see either mydump.hprof or test.hprof there...
However, after scrutinising some file timestamps in CWD, I was able to find this file, named "filename":
2017-03-29 11:42 55,572,956 filename
It is this single "filename" file in the CWD that is causing the system to output "File exists" unconditionally, disregarding the new dump targets provided by the user (because of bug(s) that always attempt to create this "filename" target file)
- relates to
-
JDK-8177064 jcmd help command should not require the process identification
-
- Closed
-
-
JDK-8195777 Better argument parsing and validation in Diagnostic Commands
-
- Closed
-