brass-kazoo edited this page Sep 14, 2010 · 6 revisions
Clone this wiki locally

I wrote this tool when I was presented with a broken website, an abandoned office, and a pile of JStack output files.

Knowing very little about the application running the website, the output files made absolutely no sense in the original format – I needed them presented in such a way that I could understand what it was they were actually telling me… Googling found no real usable solution, so I set about creating one myself.


Another contributer, oxydo recently added a maven pom, so you can (assuming you have maven) build with:

mvn clean install

Otherwise compile with your favourite IDE. The only dependancy is junit4.

Program Arguments

Currently the program takes a single file argument, of a JStack file, e.g.:

java -jar target/parse-jstack.jar ~/output.jstack

Program Output

The summary report generates 3 sections (written to the console):

1. A summary of status counts

39 threads at IN_NATIVE
503 threads at BLOCKED

2. A summary count of one-line status and class (sorted alphabetically):

195	threads at (BLOCKED)  - java.lang.Object.wait(long) @bci=-1749046076 (Interpreted frame)
26	threads at (IN_NATIVE)  - java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise)

3. A count of expanded stack traces

9	BLOCKED threads at 
		 - org.apache.naming.resources.ProxyDirContext.cacheLoad(org.apache.naming.resources.CacheEntry) @bci=438, line=1621 (Compiled frame; information may be imprecise)
		 - org.apache.naming.resources.ProxyDirContext.cacheLookup(java.lang.String) @bci=76, line=1472 (Compiled frame)
		 - org.apache.naming.resources.ProxyDirContext.lookup(java.lang.String) @bci=2, line=306 (Compiled frame)


I have effectively finished with this tool for the moment, although I hope it is of use to others. Feel free to contribute your changes!