Deadlock Debugging in Eclipse

My Eclipse-based product dead-locked this morning.

If I had launched from my Eclipse dev environment, I could use the debugger to show me the threads and locks that are giving me trouble.  Darin Swanson has the best explanation of this.

If I had started the product with “-debug -consoleLog‘ or with java.exe instead of javaw.exe, I could have hit ctrl-Break (Windows) to get a thread dump.

But I had started the product from the install bundle, so didn’t have these options.  I also didn’t think the deadlock would necessarily reproduce if I re-ran the product.  A little research showed I had more tools at my disposal than I originally realized.


If I had started the product with the Java 6 (or with Java 1.5 using the VM option), I could use jconsole to attach to my process.  Besides the stack trace, this allows all kinds of interesting monitoring.

To use the tool, you’ll need the process ID.  You can use the task manager on Windows or the  JDK tool jps to get the list of Java process IDs.

The JDK tool jstack works great to just get a quick stack dump from the command-line.  Again, you’ll need the process ID.

I need to spend some time exploring the JMX tools.  Some cool and useful stuff in here.


Another option is Send Signal, a nice program that send the Ctrl-Break signal to your Java process.


Much of the information new to me came from these 2 excellent resources.  Both pages have  other ways to get stack traces, including on *nix, and other useful debugging tips.


3 comments so far

  1. ilx on

    Another utility to help debug deadlocks:

    • Scott Kellicker on

      Thanks ‘somewhere’. Looks like a useful presentation of the stack information.

  2. […] Eclipsed […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: