Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177763

Getting an hprof dump via jcmd could benefit from stronger option checking

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u122, 9, 10
    • Fix Version/s: tbd
    • Component/s: core-svc
    • Labels:

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mgronlun Markus Grönlund
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: