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

jmap - No warning/error message if unsupported command line option is used.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 9
    • core-svc
    • 7

      When we pass unsupported 'jmap' command line option 'jmap' doesn't give any warning/error message and some times it gives following exception.

      Unsupported command line option '-F dump:live..' is used in this particular case.

      shafi@shafi-ahmad:~/Java/jdk9/jdk9-dev/hotspot$ jps
      24227 Test
      24345 Jps
      shafi@shafi-ahmad:~/Java/jdk9/jdk9-dev/hotspot$ jmap -F -dump:live,format=b,file=heap_dump.hprof 24227
      Attaching to process ID 24227, please wait...
      Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
      sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278)
      at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
      at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
      at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
      at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
      at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
      at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
      at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
      at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at sun.tools.jmap.JMap.runTool(JMap.java:201)
      at sun.tools.jmap.JMap.main(JMap.java:130)
      Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$100(LinuxDebuggerLocal.java:62)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1AttachTask.doit(LinuxDebuggerLocal.java:269)
      at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:138)

      $ java -version
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      Expected result:
      On usage of such unsupported combination 'jmap' should gives warning/error. The best action here is probably to print a warning and then ignore the "live" flag. The alternative would be to print an error and exit, and the user can fix the command.

            gadams Gary Adams (Inactive)
            shshahma Shafi Ahmad (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: