λ jmap -finalizerinfo 7924 Attaching to process ID 7924, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.131-b11 Number of objects pending for finalization: 0
λ jmap -clstats 7924 Attaching to process ID 7924, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.131-b11 finding class loader instances ..done. computing per loader stat ..done. please wait.. computing liveness.............................................................liveness analysis may be inaccurate ... class_loader classes bytes parent_loader alive? type
<bootstrap> 2587 4530544 null live <internal> 0x0000000082ab0428 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca4b8 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082d43550 0 0 0x00000000818d03c8 live org/springframework/data/convert/ClassGeneratingEntityInstantiator$ObjectInstantiatorClassGenerator$ByteArrayClassLoader@0x0000000100666650 0x0000000083151310 9 32078 0x00000000818d03c8 dead sun/reflect/misc/MethodUtil@0x0000000100639208 0x00000000819f1418 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcaa30 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cf870 1 892 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081e5fbe8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821d2810 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151e18 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x000000008217a418 14 23439 null live org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$AggregatedClassLoader@0x000000010041de20 0x0000000082a9df38 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082ab05b8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082eda7f8 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083152200 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821fed88 0 0 0x00000000818d03c8 live java/net/URLClassLoader@0x000000010000ecd0 0x0000000081bca8a0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cf6e0 1 1474 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821d2600 1 1472 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151c88 1 1473 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcae18 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000818d0428 114 264124 null live sun/misc/Launcher$ExtClassLoader@0x000000010000fa48 0x0000000083151a30 1 1473 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082a9e000 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x000000008183d228 0 0 0x00000000818d03c8 live java/util/ResourceBundle$RBClassLoader@0x00000001000f4b10 0x0000000081bca710 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083152138 1 881 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000831e52b0 1 889 0x0000000083151310 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcac88 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082a9e190 1 1474 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca580 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000818dafb0 2 4839 null dead javax/management/remote/rmi/NoCallStackClassLoader@0x00000001000df370 0x0000000081e5fa58 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821d29a0 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151fa8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000831e5120 1 881 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcaaf8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cf938 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000818d03c8 8438 14146250 0x00000000818d0428 live sun/misc/Launcher$AppClassLoader@0x000000010000f6a0 0x00000000818dbcc8 3 2774 null dead javax/management/remote/rmi/NoCallStackClassLoader@0x00000001000df370 0x0000000081e5fb20 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821d28d8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151d50 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082ab0360 1 1473 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca3f0 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000819f1350 1 880 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca968 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cf7a8 1 1485 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081e5fcb0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000821d2748 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151bc0 1 1473 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082a9de70 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082ab04f0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcaee0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000831522c8 1 1471 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082a9e0c8 1 1474 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca7d8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cf618 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083152070 1 1474 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcad50 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151af8 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000082a9e258 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bca648 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081e5f990 1 1505 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151ee0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000831e51e8 1 894 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000081bcabc0 1 880 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x00000000827cfa00 1 881 null dead sun/reflect/DelegatingClassLoader@0x0000000100009df8 0x0000000083151968 1 1473 0x00000000818d03c8 dead sun/reflect/DelegatingClassLoader@0x0000000100009df8
total = 70 11227 19067595 N/A alive=7, dead=63 N/A
-refs false|true 关闭对象引用跟踪(tracking of references to objects)。 默认值为 true. 默认情况下, 返回的指针是指向其他特定对象的对象,如反向链接或输入引用(referrers or incoming references), 会统计/计算堆中的所有对象。>
-port port-number 设置 jhat HTTP server 的端口号. 默认值 7000.>
-exclude exclude-file 指定对象查询时需要排除的数据成员列表文件(a file that lists data members that should be excluded from the reachable objects query)。 例如, 如果文件列列出了 java.lang.String.value , 那么当从某个特定对象 Object o 计算可达的对象列表时, 引用路径涉及 java.lang.String.value 的都会被排除。>
-baseline exclude-file 指定一个基准堆转储(baseline heap dump)。 在两个 heap dumps 中有相同 object ID 的对象会被标记为不是新的(marked as not being new). 其他对象被标记为新的(new). 在比较两个不同的堆转储时很有用.>
-debug int 设置 debug 级别. 0 表示不输出调试信息。 值越大则表示输出更详细的 debug 信息.>
λ jhat -J-Xmx512m dump.hprof Reading from dump.hprof... Dump file created Sat Sep 29 16:43:48 CST 2018 Snapshot read, resolving... Resolving 1639269 objects... Chasing references, expect 327 dots....................................................................................................................................................................................................................................................................................................................................... Eliminating duplicate references....................................................................................................................................................................................................................................................................................................................................... Snapshot resolved. Started HTTP server on port 7000 Server is ready.
All classes including platform Show all members of the rootset Show instance counts for all classes (including platform) Show instance counts for all classes (excluding platform) Show heap histogram Show finalizer summary Execute Object Query Language (OQL) query
一般查看堆异常情况主要看这个两个部分: Show instance counts for all classes (excluding platform),平台外的所有对象信息。如下图:
λ jstack -l 7924 | more 2018-09-29 18:04:49 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode):
"XNIO-2 task-32"#94 prio=5 os_prio=0 tid=0x000000001ea48000 nid=0x710 waiting on condition [0x0000000022a5e000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to waitfor <0x0000000083097410> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)
Locked ownable synchronizers: - None
"XNIO-2 task-31"#93 prio=5 os_prio=0 tid=0x000000001ea4e800 nid=0x3840 waiting on condition [0x000000002295e000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to waitfor <0x0000000083097410> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)
Locked ownable synchronizers: - None
"XNIO-2 task-30"#92 prio=5 os_prio=0 tid=0x000000001ea4e000 nid=0x1c54 waiting on condition [0x000000002285f000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to waitfor <0x0000000083097410> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) -- More --