Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you generate and analyze a thread dump from a running JBoss instance?

How do you generate and analyze a thread dump from a running JBoss instance?

like image 870
Teflon Ted Avatar asked Sep 12 '08 19:09

Teflon Ted


People also ask

How do you analyze thread dump?

To find the long running threads, highlight all the thread dumps you want to check, and then click on the binoculars: In the pop up dialogue, click start detection, and you'll get your long running threads just below the dumps themselves: In my example, each thread dump has 157 threads.

How do you create a thread dump?

Generating thread dumps on windowsClick the console window and press <CTRL>+BREAK (or SHIFT+CTRL+PAUSE on some keyboards). The thread dump will print directly to the console.


2 Answers

There is a JBoss-specific method that is slightly more user-friendly:

http://community.jboss.org/wiki/GenerateAThreadDumpWithTheJMXConsole

This is especially useful when you don't have direct access to the host machine (which "kill" would require).

like image 141
Matt Solnit Avatar answered Oct 05 '22 23:10

Matt Solnit


http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/

...

"On UNIX platforms you can send a signal to a program by using the kill command. This is the quit signal, which is handled by the JVM. For example, on Solaris you can use the command kill -QUIT process_id, where process_id is the process number of your Java program.

Alternatively you can enter the key sequence <ctrl>\ in the window where the Java program was started. Sending this signal instructs a signal handler in the JVM, to recursively print out all the information on the threads and monitors inside the JVM."

...

"Determining the Thread States

You will see many different threads in many different states in a snapshot from a JVM stack trace. The key used is:

R Running or runnable thread

S Suspended thread

CW Thread waiting on a condition variable

MW Thread waiting on a monitor lock

MS Thread suspended waiting on a monitor lock"

like image 27
Teflon Ted Avatar answered Oct 05 '22 22:10

Teflon Ted