Java Thread Dump Analyzer
Paste jstack or jcmd Thread.print output to find deadlocks, lock contention, stuck pools and CPU hogs. The dump is parsed in your browser, never uploaded.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Java Thread Dump Analyzer?
Paste the output of jstack <pid>, jcmd <pid> Thread.print or a kill -3 console print, or drop the file, and this tool reads every thread into a verdict: deadlocks first, then the state histogram, lock contention, thread pools, groups of threads stopped at identical frames, and the threads that have burned the most CPU. A 2,000-thread dump from a production incident reads the same way as a 20-thread one from your laptop.
Deadlocks are found two ways. The JVM appends its own "Found one Java-level deadlock" report to most dumps, and the tool reads it; it also walks the waiting-to-lock and locked annotations itself, so a dump trimmed by a log pipeline, where that trailing report is often lost, still gets its deadlock named. A cycle found only from the lock graph is labelled as such.
The dump is parsed by JavaScript in this tab. Thread names and stack frames, which often carry internal class and host names, are not uploaded, logged or stored.
- Deadlock detection from the lock graph, cross-checked against the JVM's own report
- State histogram, daemon and VM-internal thread counts
- Lock contention table: monitor, holder, queue length
- Pools grouped by name prefix; identical stacks grouped by top frames
- Top CPU table from the cpu= attribute (JDK 11+)
- Copyable text summary for tickets and chat
- Runs entirely in your browser; the dump is never uploaded
Updated
How to use the Java Thread Dump Analyzer
- Capture a dump: jcmd <pid> Thread.print (add -l for java.util.concurrent lock detail), jstack <pid>, or kill -3 <pid>, which prints it to the console without stopping the process.
- Paste the text, or drop the saved file. Press Analyze, or press Load a sample to see the output on a real deadlocked dump.
- Read the verdict: a red banner names each deadlock cycle. No banner means no cycle among BLOCKED threads.
- Check the state bar and the contention table: many BLOCKED threads on one monitor names the lock to split; a pool fully in WAITING or TIMED_WAITING is idle or starved.
- For CPU, take a second dump 5 to 10 seconds later and compare the cpu= growth; the printed value is cumulative since each thread started.
Worked examples
A deadlocked pair, named from the lock graph
Input
"deadlock-a": locked <0x...b578>, waiting to lock <0x...b588> "deadlock-b": locked <0x...b588>, waiting to lock <0x...b578>
Output
DEADLOCK: deadlock-a → deadlock-b → deadlock-a
Each thread holds the monitor the other needs, so neither can ever run again. The sample dump built into the tool contains exactly this pair; the parser finds the cycle itself and confirms it against the JVM's own report.
The sample dump, summarised
Input
The built-in sample: a jcmd Thread.print from OpenJDK 17.0.21.1
Output
7 Java threads (2 daemon) + 1 VM threads; states: 3 TIMED_WAITING, 2 BLOCKED, 1 WAITING, 1 RUNNABLE
The one RUNNABLE thread is the C2 JIT compiler, and the WAITING thread is the Finalizer parked on its ReferenceQueue, both normal. The story is the two BLOCKED threads, which are the deadlock above.
A pool stopped in one place
Input
pool-worker-0 and pool-worker-1, both TIMED_WAITING in Thread.sleep at Leaky.sleep(Leaky.java:22)
Output
thread pools: pool-worker* ×2 (2 TIMED_WAITING); identical stacks: ×2 at java.lang.Thread.sleep
Threads with a shared name prefix and a trailing number are grouped as a pool, and threads whose top eight frames match are grouped as one stack. A whole pool parked on the same frame is the shape of an empty queue or a slow downstream.
Object.wait() is not a deadlock
Input
"Finalizer": locked <0x...2f40> and waiting on <0x...2f40>, the same ReferenceQueue lock
Output
No deadlock reported; Finalizer is not listed as a monitor holder
The dump shows the acquisition that led into wait(), but wait() released the monitor. A naive reading calls this a one-thread deadlock; the test suite pins that this parser does not.
Background and insight
A HotSpot thread dump lists each thread with a quoted name, attributes (daemon, priority, cpu= and elapsed= since JDK 11), a java.lang.Thread.State line, stack frames, and lock annotations: locked, waiting to lock, waiting on, parking to wait for. The java.lang.Thread.State javadoc defines six states; the two that get misread are BLOCKED, a thread waiting to enter a synchronized block whose monitor another thread holds, and WAITING, a thread that called Object.wait(), Thread.join() or LockSupport.park() and is waiting to be woken. Only BLOCKED threads can form a monitor deadlock. RUNNABLE means executing in the JVM, but the javadoc notes such a thread may still be waiting on the operating system, which is why a thread stuck in a socket read shows as RUNNABLE.
One subtlety the analyzer handles: a thread inside Object.wait() shows the monitor it entered as locked in its stack, but wait() releases that monitor. Counting it as the holder invents contention and a one-thread deadlock around the JDK's own Finalizer thread; this parser knows the wait and excludes it, and the regression test pins that.
VM-internal threads (GC workers, JIT compiler threads) have no Thread.State line. They are counted separately rather than mixed into the Java thread states, and they still appear in the CPU table, where a busy "C2 CompilerThread0" right after startup is normal and a busy GC thread an hour in is not.
Common use cases
A service stopped responding
Take one dump and look for a deadlock banner or hundreds of BLOCKED threads queuing on one monitor; both name the code to fix.
Requests queue but CPU is idle
Check the pools table: an http-nio or ForkJoinPool whose workers all wait at the same frame points at the resource they are starved of, usually a connection pool or a remote call.
CPU pegged at 100%
Take two dumps a few seconds apart and compare the CPU table; the thread whose cpu= value grew by the interval is the spinner, and its stack says where.
Reading a dump from a log pipeline
Dumps pasted from Kibana or a ticket often lose the JVM's trailing deadlock report. The lock-graph walk finds the cycle anyway and labels it as recovered.
Confirming a fix
After splitting a hot lock, dump again and compare the contention table: the waiter count on that monitor is the before-and-after number for the review.
Tips and limitations
- Take three dumps 5 to 10 seconds apart. A thread BLOCKED in all three is a problem; a thread BLOCKED in one is often just a moment of ordinary locking.
- jstack is marked experimental and unsupported in its own JDK manual page; jcmd <pid> Thread.print is the supported route and prints the same format.
- The cpu= attribute appeared in JDK 11 dumps. On JDK 8 output the CPU table is empty; the rest of the analysis is unchanged.
- Threads parked in java.util.concurrent locks show as WAITING on a AbstractQueuedSynchronizer ConditionObject, not BLOCKED. Capture with jcmd -l to also print which ReentrantLock they own; deadlocks built from ReentrantLock cycles are not detected here.
- A dump is one instant. For a leak that builds over minutes, pair it with a heap dump: the Java Heap Dump Analyzer on this site reads the .hprof the same private way.
- Every way to take the dump, from jcmd and kill -3 to JMX and Kubernetes, with each option measured on JDK 17, is in the guide to taking a Java thread dump (/blog/how-to-take-a-java-thread-dump).
- kill -3 (SIGQUIT) writes the dump to the process console without pausing or restarting it, so it is safe on production; find it in the container's stdout log.
Sources and further reading
- java.lang.Thread.State (Java SE 21 API), Oracle. Definitions of the six thread states, including the BLOCKED and WAITING distinction
- The jcmd Command (JDK 21 tool specifications), Oracle. Thread.print and its -l and -e options
- The jstack Command (JDK 21 tool specifications), Oracle. Syntax, the -l option, and its experimental and unsupported status
Frequently asked questions
Is it safe to paste a production thread dump here?
The parse runs in JavaScript in your tab; nothing is sent to a server, logged or kept. Thread names and frames can reveal internal hostnames and class names, which is exactly why this tool does not transmit them. Closing the tab discards everything.
What is the difference between BLOCKED and WAITING?
BLOCKED means the thread wants a monitor another thread holds (entering a synchronized block). WAITING means it called Object.wait(), Thread.join() or LockSupport.park() and is waiting to be signalled. Per the Thread.State javadoc, these are distinct states; only BLOCKED threads can form a monitor deadlock.
Why does a thread reading a socket show as RUNNABLE?
RUNNABLE is a JVM state, not an OS state. The javadoc says a runnable thread may be waiting for other resources from the operating system, and a blocking read inside native code is exactly that. Judge such threads by their stack frames, not the state label.
How do I find which Java thread is burning CPU?
The CPU table shows cpu= per thread, but it is cumulative since thread start. Take two dumps 10 seconds apart; the thread whose value grew by about 10,000 ms used a full core between them. On JDK 8 the attribute is absent, so use top -H and match the native thread id to the nid= field.
Can this detect deadlocks between ReentrantLocks?
No. The monitor annotations in a dump cover synchronized blocks; a ReentrantLock cycle shows only as threads parked WAITING. Dump with jcmd <pid> Thread.print -l to print the owned java.util.concurrent synchronizers and trace the cycle by hand, or use ThreadMXBean.findDeadlockedThreads(), which covers ownable synchronizers.
How many threads is too many?
There is no single limit; each platform thread costs a stack (1 MB by default with -Xss on 64-bit HotSpot) and scheduler work. The practical signals are pools far larger than their work, thousands of TIMED_WAITING threads with a shared prefix, or growth between two dumps, which is a thread leak.
Does the analyzer work with virtual threads?
Partly. A plain Thread.print lists carrier and platform threads; mounted virtual threads appear in their carrier stacks. JDK 21 added jcmd Thread.dump_to_file for a full virtual-thread listing, but that is a different format this tool does not parse yet.
Is there an in-depth guide to the Java Thread Dump Analyzer?
Yes. “How to Capture and Read Heap Dumps and Thread Dumps” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.