INTRODUCTION:
Often, in order to obtain more information with regards to the threads and their internal state, users can make use of a thread dump. The thread dump of a java program (such as application servers) is valuable in understanding and isolating problems related to stability, performance, memory consumption, CPU utilization, etc. Keep in mind that obtaining the thread dump for an application server depends on the operating system on which the Java process/application server is running. Also, different application servers may provide custom methods of obtaining a thread dump via batch files/shell scripts. Here, we list several methods for specific configurations.
COLLECTING THREAD DUMPS:
Unix:
In a terminal window, use the command:
kill -3 <PID>
Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Standalone Apache Tomcat/4.1.30 Http11Protocol - -Starting Coyote HTTP/1.1 on port 8080 ChannelSocket - -JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009 JkMain - -Jk running ID=0 time=1/25 config=/user0/sandbox/apsweb/tomcat/jakarta-tomcat-4.1.30/conf/jk2.properties Strategy Web logging initialized using logger.properties Strategy Web logging re-initialized using /user0/sandbox/apsweb/tomcat/jakarta-tomcat-4.1.30/webapps/WebMstr7/WEB-INF/log/logger.properties Strategy Web logging re-initialized using /user0/sandbox/apsweb/tomcat/jakarta-tomcat-4.1.30/webapps/WebMstr7/WEB-INF/log/logger.properties Full thread dump: "Thread-17" daemon prio=5 tid=0xe81c8 nid=0x21 waiting on monitor at java.lang.Object.wait(Native Method) at java.util.TimerThread.mainLoop(Timer.java:427) at java.util.TimerThread.run(Timer.java:380) "http8080-Processor2" daemon prio=5 tid=0x7749c0 nid=0x12 waiting on monitor at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:415) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656) at java.lang.Thread.run(Thread.java:479) "http8080-Processor1" daemon prio=5 tid=0x776340 nid=0x11 waiting on monitor at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:415) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656) at java.lang.Thread.run(Thread.java:479) "HostConfig" daemon prio=5 tid=0x773718 nid=0x10 waiting on monitor at java.lang.Thread.sleep(Native Method) at org.apache.catalina.startup.HostConfig.threadSleep(HostConfig.java:824) at org.apache.catalina.startup.HostConfig.run(HostConfig.java:848) at java.lang.Thread.run(Thread.java:479) "StandardManager" daemon prio=5 tid=0x769ac0 nid=0xc waiting on monitor at java.lang.Thread.sleep(Native Method) at org.apache.catalina.session.StandardManager.threadSleep(StandardManager.java:810) at org.apache.catalina.session.StandardManager.run(StandardManager.java:869) at java.lang.Thread.run(Thread.java:479) "Signal Dispatcher" daemon prio=10 tid=0xa5ca8 nid=0xa waiting on monitor "Finalizer" daemon prio=8 tid=0xa1e40 nid=0x7 waiting on monitor at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:103) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:157) "Reference Handler" daemon prio=10 tid=0xa0508 nid=0x6 waiting on monitor at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:415) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:105) "main" prio=5 tid=0x289e8 nid=0x1 runnable at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:463) at java.net.ServerSocket.implAccept(ServerSocket.java:238) at java.net.ServerSocket.accept(ServerSocket.java:217) at org.apache.catalina.core.StandardServer.await(StandardServer.java:527) at org.apache.catalina.startup.Catalina.start(Catalina.java:521) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) "VM Thread" prio=5 tid=0x9f8a0 nid=0x4 runnable "VM Periodic Task Thread" prio=10 tid=0xa3de8 nid=0x8 waiting on monitor "Suspend Checker Thread" prio=10 tid=0xa53b0 nid=0x9 runnable