Guide: How to grab a Thread Dump
Posted: 05 Jul 2012, 10:11
A thread dump shows the status of all threads in the JVM, very useful for troubleshooting problems at runtime.
Here's how it can be done:
From a terminal/console: (all OSes)
First we need the java process's PID.
The JDK ships with the jps utility which lists all java process ids. It's under the bin/ folder.
You can run this command:
Example result:
So the SFS2X PID is 8434
Then we used another JDK utility called jstack, this way:
... which will produce the thread dump.
More on these tools:
http://docs.oracle.com/javase/1.5.0/doc ... e/jps.html
http://docs.oracle.com/javase/1.5.0/doc ... stack.html
Last update, Nov 27th 2012
Here's how it can be done:
From a terminal/console: (all OSes)
First we need the java process's PID.
The JDK ships with the jps utility which lists all java process ids. It's under the bin/ folder.
You can run this command:
Code: Select all
jps -l
Example result:
Code: Select all
9048 sun.tools.jps.Jps
8434 com.smartfoxserver.v2.Main
So the SFS2X PID is 8434
Then we used another JDK utility called jstack, this way:
Code: Select all
jstack 8434
... which will produce the thread dump.
More on these tools:
http://docs.oracle.com/javase/1.5.0/doc ... e/jps.html
http://docs.oracle.com/javase/1.5.0/doc ... stack.html
Last update, Nov 27th 2012