Recently I was working away developing and repeatedly kept having Eclipse lock up on me via a deadlock. Annoying!
Since I have the privilege of working both on and in Eclipse I had the tools at hand to diagnose the problem. Since your CPU is not doing any work whilst sitting in a deadlock you may as well invoke the debugger and log the bug to save yourself and others future pain.
Of course I knew the problem was not in my code :-)
But I had no idea where the bug might be hiding.
So I launched a debug session of the Eclipse application and performed the steps I knew would lead to the deadlock.
Once in the deadlock I went to the debug view, and set it to show monitor information via the view menu.
I selected the debug process and clicked "pause".
This will pause the JVM and suspend execution of all threads (not like they were doing anything anyway!).
The Eclipse debug framework will make it easy for your to diagnose and report the problem.
Within the view, the threads that are in contention will be indicated in red. The monitor(s) that a thread is waiting for and/or owns are indicated.
In the simple example shown below we have two threads that are deadlocked
Even better when you log the bug report you can provide stack traces pointing right to the problem.
- western states
- catalyst challenge
- tourist run