JDK-8252731 : -gz option for GC.heap_dump isn't recognized
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2020-08-28
  • Updated: 2020-09-08
  • Resolved: 2020-09-08
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
>\java\jdk-15\bin\java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment (build 15+36-1562)
OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

running on Windows 10

A DESCRIPTION OF THE PROBLEM :
jdk 15 release candidate is supposed to have added a -gz option for GC.heap_dump from JDK-8237354.
I have used the latest release candidate available from https://jdk.java.net/15/ - Build 36 (2020/8/11), using the windows JDK.

>\java\jdk-15\bin\jcmd 31028 GC.heap_dump -gz=9 Myheapdump
31028:
java.lang.IllegalArgumentException: Unknown argument 'Myheapdump' in diagnostic command.


>\java\jdk-15\bin\jcmd 31028 help GC.heap_dump
31028:
GC.heap_dump
Generate a HPROF format dump of the Java heap.

Impact: High: Depends on Java heap size and content. Request a full GC unless the '-all' option is specified.

Permission: java.lang.management.ManagementPermission(monitor)

Syntax : GC.heap_dump [options] <filename>

Arguments:
        filename :  Name of the dump file (STRING, no default value)

Options: (options must be specified using the <key> or <key>=<value> syntax)
        -all : [optional] Dump all objects, including unreachable objects (BOOLEAN, false)



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute 
jcmd <pid> GC.heap_dump -gz=9 Myheapdump
on a windows system

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expecting something like
>\java\jdk-15\bin\jcmd 31028 GC.heap_dump Myheapdump
31028:
Dumping heap to Myheapdump ...
Heap dump file created [10191759 bytes in 0.075 secs]

ACTUAL -
>\java\jdk-15\bin\jcmd 31028 GC.heap_dump -gz=9 Myheapdump
31028:
java.lang.IllegalArgumentException: Unknown argument 'Myheapdump' in diagnostic command.


---------- BEGIN SOURCE ----------
Run against any Java application
---------- END SOURCE ----------

FREQUENCY : always



Comments
Hi, this is the expected behavior. The options a jcmd command can handle are determined by the VM you perform the command on, not the version of the JDK from which the jcmd is called. So I assume the java process with pid 31028 is not new enough. This is why the help output doesn't mention the -gz option too. Best regards, Ralf
05-09-2020