Weekend Project: Thread Dump Viewer for Eclipse

by Алекс Руис on November 5, 2012

A couple of weeks ago, one of our users reported that Eclipse consistently froze when executing some action. I was hoping that Eclipse would have an editor where I can open the thread dump I got and navigate, through hyperlinks, from stack traces to source code. The closest thing I found was the “Java Stack Trace Console,” which provides hyperlinking to source code. It would have been nice if there is a specialized editor that provides the following features, besides code navigation:

  • an Outline View that shows the threads by name (with icons representing their state) and any deadlocks found
  • some basic syntax highlighting to make reading easier
  • ability to collapse blocks (e.g. a thread or stack trace) to minimize noise
  • navigation to thread definitions from references (e.g. a deadlock)

BTW, IntelliJ IDEA provides something somehow close to what I’m asking for since 2008! 2008!

In addition, I didn’t want a tool that analises a thread dump for me (e.g. TDA or the IBM one.) So far, I haven’t seen a thread dump that is that hard to read.

Of course I had to scratch my own itch! This past weekend I finally had time to write my own “Thread Dump Viewer.” It is an editor that provides everything I described. I was able to write a working editor in a matter of hours, using Xtext. The key was getting the grammar right. I spent an additional couple of hours making it “prettier.”

Here is a screenshot of the editor (click to enlarge.)

Here is a demo showing off the features of the “Thread Dump Viewer.”

I created this tool for my own use. I haven’t open-sourced the code or made the plug-in publicly available simply because I don’t know if anybody else would find this tool useful. If you do, please leave a comment.

(10/07/12) Update: I’m in the process of open sourcing this plug-in. I need to do some cleanup (code formatting, add copyright headers, etc.) first. I expect the first version of the plug-in to be what I have now. Right after that, I’ll be implementing the features mentioned in the comments:

  • detection of multiple threads locking on the same object
  • compare multiple thread dumps with each other

Many thanks to everyone that left a comment! :)

{ 12 comments… read them below or add one }

Christopher Roscoe November 5, 2012 at 7:17 am

I would love to see this plugin in action.

Reply

Pascal Rapicault November 5, 2012 at 7:54 am

I’d use that.

Reply

Chris Murray November 5, 2012 at 8:28 am

I’d use that too.

Reply

Sebastian November 5, 2012 at 8:56 am

Very cool. I would like to give it a try.

Reply

jotomo November 5, 2012 at 9:11 am

Came here by way of googling on how to find out which plugin freezes my installation, so I’d like to join the “I’d find this useful”-canon :-)

Reply

Wolfgang Schell November 5, 2012 at 9:33 am

Cool plugin, I would also be interested!

Feature-wise the detection of multiple threads locking on the same object would nice, so I can instantly detect all threads being blocked by another.

Reply

Tonny Madsen November 5, 2012 at 12:28 pm

That would have come handy a couple of times :-) Please make it public :-)

Reply

J.-P. Pellet November 6, 2012 at 1:53 am

This is great, I’d be very interested, too!

Reply

Sascha November 6, 2012 at 6:08 am

I also would very much like to see that and probably also improve on it (aka +1 for open sourcing it ;) ). I regularly have to deal with +200 threads in a thread dump and one crucial feature is to compare multiple thread dumps with each other (to see which threads got stuck). Would love to have that inside my Eclipse.

Reply

Jacek November 6, 2012 at 6:34 am

Very cool. I used something similar in past. Together with automatic thread dump generation when app is not responding it can do miracles to your product. https://gist.github.com/4024731

Reply

Kristoffer Peterhänsel November 20, 2012 at 1:43 am

Looks interesting. Especially since other similar tools seem very fragile. TDA has some very strange UI update bugs. And Lockness (http://lockness.plugin.free.fr), the other Eclipse plugin I know of, is not very flexible in supporting thread dump formats and encodings.

So hopefully your tool will require less hoops to jump though – or at least be easier to ‘fix’ ;)

Reply

Praveen January 30, 2013 at 12:56 pm

Do you have this public yet. I agree with everyone else , that this could be very useful.

Reply

Leave a Comment

Previous post:

Next post: