美文网首页
jmap错误:unknown CollectedHeap typ

jmap错误:unknown CollectedHeap typ

作者: sunpy | 来源:发表于2019-02-14 13:31 被阅读50次

    错误场景

    今天使用jmap -heap命令查看堆的详细信息报错。

    [root@instance-2gak1pfv debuginfo]# java -version
    openjdk version "1.8.0_191"
    OpenJDK Runtime Environment (build 1.8.0_191-b12)
    OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
    
    [root@instance-2gak1pfv debuginfo]# jps -l
    110386 org.apache.zookeeper.server.quorum.QuorumPeerMain
    40565 sun.tools.jps.Jps
    [root@instance-2gak1pfv debuginfo]# jmap -heap 110386
    Attaching to process ID 110386, please wait...
    Debugger attached successfully.
    Server compiler detected.
    JVM version is 25.191-b12
    
    using thread-local object allocation.
    Mark Sweep Compact GC
    
    Heap Configuration:
       MinHeapFreeRatio         = 40
       MaxHeapFreeRatio         = 70
       MaxHeapSize              = 255852544 (244.0MB)
       NewSize                  = 5570560 (5.3125MB)
       MaxNewSize               = 85262336 (81.3125MB)
       OldSize                  = 11206656 (10.6875MB)
       NewRatio                 = 2
       SurvivorRatio            = 8
       MetaspaceSize            = 21807104 (20.796875MB)
       CompressedClassSpaceSize = 1073741824 (1024.0MB)
       MaxMetaspaceSize         = 17592186044415 MB
       G1HeapRegionSize         = 0 (0.0MB)
    
    Heap Usage:
    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.RuntimeException: unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap
        at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:157)
        at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:50)
        ... 6 more
    

    解决办法:
    安装debuginfo,去网站http://debuginfo.centos.org/7/x86_64里面找匹配当前的openjdk的版本,小版本号也要匹配上。然后使用wget命令下载

    wget http://debuginfo.centos.org/7/x86_64/java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64.rpm
    

    使用rpm命令安装

    rpm -ivh java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64.rpm
    

    然后查看是否安装了debuginfo

    [root@izuf6ea4rfo45y44oj74jhz logs]# rpm -qa|grep debuginfo
    java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64
    

    执行jmap -heap命令查看堆详细信息

    [root@izuf6ea4rfo45y44oj74jhz logs]# jmap -heap 1421
    Attaching to process ID 1421, please wait...
    Debugger attached successfully.
    Server compiler detected.
    JVM version is 25.191-b12
    
    using thread-local object allocation.
    Mark Sweep Compact GC
    
    Heap Configuration:
       MinHeapFreeRatio         = 40
       MaxHeapFreeRatio         = 70
       MaxHeapSize              = 482344960 (460.0MB)
       NewSize                  = 10485760 (10.0MB)
       MaxNewSize               = 160759808 (153.3125MB)
       OldSize                  = 20971520 (20.0MB)
       NewRatio                 = 2
       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 = 48758784 (46.5MB)
       used     = 42933176 (40.94426727294922MB)
       free     = 5825608 (5.555732727050781MB)
       88.05218768376176% used
    Eden Space:
       capacity = 43384832 (41.375MB)
       used     = 42933176 (40.94426727294922MB)
       free     = 451656 (0.43073272705078125MB)
       98.95895413401624% used
    From Space:
       capacity = 5373952 (5.125MB)
       used     = 0 (0.0MB)
       free     = 5373952 (5.125MB)
       0.0% used
    To Space:
       capacity = 5373952 (5.125MB)
       used     = 0 (0.0MB)
       free     = 5373952 (5.125MB)
       0.0% used
    tenured generation:
       capacity = 108146688 (103.13671875MB)
       used     = 64887344 (61.88139343261719MB)
       free     = 43259344 (41.25532531738281MB)
       59.99938158069159% used
    
    21962 interned Strings occupying 2552376 bytes.
    

    相关文章

      网友评论

          本文标题:jmap错误:unknown CollectedHeap typ

          本文链接:https://www.haomeiwen.com/subject/duheeqtx.html