解决JMap抓取heap使用统计信息报错的问题

如下所示:

******************************

/jmap jdk small version diffrent from jvm jdk vesionbegin///

[dev@iZ2ze8us9p89pfk02m9vs1Z ~]$ jmap -heap 1541

Attaching to process ID 1541, please wait...

Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file

sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file

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.HeapSummary.main(HeapSummary.java:49)

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:498)

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: cannot open binary file

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)

/jmap jdk small version diffrent from jvm jdk vesionend///

/jmap jdk big version diffrent from jvm jdk vesionbegin///

Attaching to process ID 30413, please wait...

Exception in thread "main" java.lang.reflect.InvocationTargetException

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:498)

at sun.tools.jmap.JMap.runTool(JMap.java:201)

at sun.tools.jmap.JMap.main(JMap.java:130)

Caused by: java.lang.InternalError: void* type hasn't been seen when parsing int*

at sun.jvm.hotspot.HotSpotTypeDataBase.recursiveCreateBasicPointerType(HotSpotTypeDataBase.java:721)

at sun.jvm.hotspot.HotSpotTypeDataBase.lookupType(HotSpotTypeDataBase.java:134)

at sun.jvm.hotspot.HotSpotTypeDataBase.lookupOrCreateClass(HotSpotTypeDataBase.java:631)

at sun.jvm.hotspot.HotSpotTypeDataBase.createType(HotSpotTypeDataBase.java:751)

at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:195)

at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:89)

at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:395)

at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)

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.HeapSummary.main(HeapSummary.java:49)

... 6 more

/jmap jdk big version diffrent from jvm jdk vesionend///

****************************************

【问题】

执行jmap -heap命令是报错,方法返回参数类型不匹配

【分析】

考虑执行jmap的jdk版本同目标jvm的jdk版本不一致:

1> 如果jmap的jdk版本比目标jvm高,执行会提示方法不兼容错误

2> 如果jmap的jdk版本比目标jvm低,执行会提示jdk版本不一致错误

【解决】

采用执行jmap的jdk版本同目标jvm的jdk版本保持一致。

补充知识:jmap -heap返回结果分析

using parallel threads in the new generation.

using thread-local object allocation.

Concurrent Mark-Sweep GC

Heap Configuration:

MinHeapFreeRatio = 40

MaxHeapFreeRatio = 70

MaxHeapSize = 4294967296 (4096.0MB)

NewSize = 858980352 (819.1875MB)

MaxNewSize = 858980352 (819.1875MB)

OldSize = 3435986944 (3276.8125MB)

NewRatio = 4

SurvivorRatio = 8

MetaspaceSize = 21807104 (20.796875MB)

CompressedClassSpaceSize = 1073741824 (1024.0MB)

MaxMetaspaceSize = 17592186044415 MB

G1HeapRegionSize = 0 (0.0MB)

Heap Usage:

新生代

New Generation (Eden + 1 Survivor Space):

capacity = 773128192 (737.3125MB)

used = 95478696 (91.05558013916016MB)

free = 677649496 (646.2569198608398MB)

12.349659084738175% used

Eden Space:

capacity = 687276032 (655.4375MB)

used = 95478696 (91.05558013916016MB)

free = 591797336 (564.3819198608398MB)

13.892336056322709% used

From Space:

capacity = 85852160 (81.875MB)

used = 0 (0.0MB)

free = 85852160 (81.875MB)

0.0% used

To Space:

capacity = 85852160 (81.875MB)

used = 0 (0.0MB)

free = 85852160 (81.875MB)

0.0% used

concurrent mark-sweep generation:

capacity = 3435986944 (3276.8125MB)

used = 119572370833685648 (1.1403309901588979E11MB)

free = 17478152948676 MB

3.480000732903997E9% used

根据以上数据,我们来check一些ratio:

NewRatio = 2

Eden Space capacity = 1063256064 (1014.0MB)

From Space capacity = 4718592 (4.5MB)

To Space capacity = 5242880 (5.0MB)

简单加法,

New size=1014.0+4.5+5.0=1023.5MB

MaxHeapSize = 3221225472 (3072.0MB)

年轻代占比:

1023.5/3072.0=1/3。

换算NewRatio的计算,老年代/新生代,结果为2

以上这篇解决JMap抓取heap使用统计信息报错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

以上是 解决JMap抓取heap使用统计信息报错的问题 的全部内容, 来源链接: utcz.com/z/350586.html

回到顶部