Admin: Thread Dump

From Resin 3.0

Jump to: navigation, search


Contents

Thread Dump

The /resin-admin thread dump page shows all the threads in the JVM at the time you refresh the page.

Each thread has a stack trace to show what all the threads are doing.

In general, you'll use the thread dump to track down issues where too many threads are active, where threads are blocking other threads, and where threads are stuck.

The /resin-admin page sorts the threads into a number of tabs to help track down issues quickly.

Active

The Active threads are those threads currently running. In a normal system, the number of threads is relatively low. If you have a heavily loaded system, you'll have a larger number of active threads.

When your systems CPU goes to 100%, the thread that's causing the problem will be one of the active threads.

JNI

The JNI threads are typically Resin threads waiting for some data. For example, a HTTP keepalive thread waiting for the browser to send the next request. Normally, the JNI threads are idle, waiting for some I/O to occur.

Locking

The locking tab is a special collection of threads which are waiting on other threads. If you have a large number of threads in the locking section, your system may be slow or may not be using all your CPUs effectively.

In the locking tab, the threads are partitioned into groups where each group is a set of threads waiting on a lock owned by one of the threads. This partitioning will let you quickly find the thread that's blocking the other threads.

When you expand the stack trace, you'll see bolded "-- locked" items which show the lock that's causing the problem.

Misc

The miscellaneous threads are threads that do not fall into any other categories.

Wait

Wait threads are sleeping, waiting for a second thread to wake them up, or waiting for a timeout. Resin's idle threads in the thread pool are listed in the wait group.

A stuck thread can sometimes be in the wait state if there's a bug where a thread isn't properly woken at the right time. Typically, though, these threads are just idle waiting for the next activity.

All

All the threads in the system are listed in the "All" tab. Typically, a thread will be in two tabs, the "All" tab and its sorted tab. In some cases, a thread may be in a third tab, the "locked" tab, if it owns a lock that another thread is waiting for.

Locking

The locking tab is useful when you're trying to improve the multi-cpu scalability of the application, or track down a locking problem which is freezing or slowing down a large number of threads.

The locking tab groups the locked threads by the lock their waiting for, one section per lock. The first thread in the group is the lock owner, and the other threads are waiting for the lock.

In the following screenshot, there one lock displayed "SocksSocketImpl@3e5d8e63", and two threads.

Thread-dump-locking.png

The first thread (43) is holding the lock, as displayed by the "locked" line:

 -- locked java.net.SocketsSocketImpl@0x3e5e8e63

The second thread (45) is waiting for the lock, as displayed by the "waiting" line:

 -- waiting on java.net.SocksSocketImpl@3e5d8e63 owned by 43
Personal tools