我们如何在Application挂起时分析线程转储

时间:2013-08-20 12:00:22

标签: thread-dump

我们面临的问题是我们的应用程序挂起,我们需要重新启动应用程序。

这是针对它的线程转储。我想了解我们如何分析线程转储,我的意思是我们可以通过任何方式找到存在问题的代码。

2013-04-12 13:05:07
Full thread dump Java HotSpot(TM) Client VM (19.1-b02 mixed mode):

"Low Memory Detector" daemon prio=6 tid=0x00d6d800 nid=0xebc runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=10 tid=0x00d60c00 nid=0x1b50 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Attach Listener" daemon prio=10 tid=0x00d5dc00 nid=0x16c8 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x00d5a800 nid=0xd1c runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=0x00ceec00 nid=0x1148 in Object.wait() [0x1750f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x03221158> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
    - locked <0x03221158> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00ced800 nid=0xff8 in Object.wait() [0x1747f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x03221058> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:485)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
    - locked <0x03221058> (a java.lang.ref.Reference$Lock)

"main" prio=6 tid=0x00ca2800 nid=0x1154 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" prio=10 tid=0x00cf8400 nid=0x798 runnable 

"VM Periodic Task Thread" prio=10 tid=0x00d89000 nid=0xc64 waiting on condition 

JNI global references: 924

1 个答案:

答案 0 :(得分:-3)

线程转储从执行kill -3的VM写入系统。如果要将JVM的控制台输出重定向到文件,则线程转储将位于该文件中。如果JVM在打开的控制台中运行,则线程转储将显示在其控制台中,通过实验练习查看完整的演示here