jcmd commands mostly work fine on a JVM with -XX:-UsePerfData.
Although the JVM is not listed by "jps", it is reasonable to find a JVM PID and use jcmd against it.
PerfCounter.print (a special jcmd), although expected to fail if the target uses -XX:-UsePerfData, fails with a misleading/confusing error:
$ jcmd 23816 PerfCounter.print
23816:
sun.jvmstat.monitor.MonitorException: Could not attach to 23816
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.PerfDataBuffer.<init>(PerfDataBuffer.java:68)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.LocalMonitoredVm.<init>(LocalMonitoredVm.java:66)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostProvider.getMonitoredVm(MonitoredHostProvider.java:77)
at jdk.jcmd/sun.tools.jcmd.JCmd.listCounters(JCmd.java:144)
at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:94)
Caused by: java.lang.IllegalArgumentException: Could not map vmid to user Name
at java.base/jdk.internal.perf.Perf.attach0(Native Method)
at java.base/jdk.internal.perf.Perf.attach(Perf.java:184)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.PerfDataBuffer.<init>(PerfDataBuffer.java:64)
... 4 more
bash-4.2$
We know jcmd can attach to the process, and the failure does not relate to vmid and user name mappings.
We cannot locate the hsperfdata shared memory file, because it does not exist.
jcmd should be reporting "cannot locate hsperfdata" or similar.
perfMemory_posix.cpp / get_user_name_slow has to navigate /proc/{pid}/root/tmp to find an hsperfdata file... Failure gives the misleading message, but more detail would help the user.
The message/stack is in several bug reports, e.g. JDK-8231385,JDK-8226367
PerfData failing to allocate could also produce this, if not specifically -XX:-UsePerfData
Although the JVM is not listed by "jps", it is reasonable to find a JVM PID and use jcmd against it.
PerfCounter.print (a special jcmd), although expected to fail if the target uses -XX:-UsePerfData, fails with a misleading/confusing error:
$ jcmd 23816 PerfCounter.print
23816:
sun.jvmstat.monitor.MonitorException: Could not attach to 23816
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.PerfDataBuffer.<init>(PerfDataBuffer.java:68)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.LocalMonitoredVm.<init>(LocalMonitoredVm.java:66)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostProvider.getMonitoredVm(MonitoredHostProvider.java:77)
at jdk.jcmd/sun.tools.jcmd.JCmd.listCounters(JCmd.java:144)
at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:94)
Caused by: java.lang.IllegalArgumentException: Could not map vmid to user Name
at java.base/jdk.internal.perf.Perf.attach0(Native Method)
at java.base/jdk.internal.perf.Perf.attach(Perf.java:184)
at jdk.internal.jvmstat/sun.jvmstat.perfdata.monitor.protocol.local.PerfDataBuffer.<init>(PerfDataBuffer.java:64)
... 4 more
bash-4.2$
We know jcmd can attach to the process, and the failure does not relate to vmid and user name mappings.
We cannot locate the hsperfdata shared memory file, because it does not exist.
jcmd should be reporting "cannot locate hsperfdata" or similar.
perfMemory_posix.cpp / get_user_name_slow has to navigate /proc/{pid}/root/tmp to find an hsperfdata file... Failure gives the misleading message, but more detail would help the user.
The message/stack is in several bug reports, e.g. JDK-8231385,
PerfData failing to allocate could also produce this, if not specifically -XX:-UsePerfData
- relates to
-
JDK-8069149 jdk.internal.perf.Perf is unaware of the VM option UsePerfData
-
- Open
-