【发布时间】:2018-12-01 20:39:11
【问题描述】:
在 Ubuntu Mate 18.04-64bits 和 Oracle JDK 10.0.1-64bits 上使用 jmap,该工具仅在以 root 身份运行目标和工具时才有效,但使用相同的普通用户运行两者会出现以下错误:
Exception in thread "main" com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/13538/cwd/.attach_pid13538: target process 13538 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:103)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:124)
at jdk.jcmd/sun.tools.jmap.JMap.main(JMap.java:114)
使用root用户运行以下命令时
jmap -clstats <pid>
【问题讨论】:
-
这是唯一可用的信息:
-clstats Prints class loader wise statistics of Java heap. For each class loader, its name, how active it is, address, parent class loader, and the number and size of classes it has loaded are printed.