What techniques can one use to debug what appears to be a deadlock in a Java program.
My IDE is Eclipse and I think I've identifid the two deadlocked threads. In the debugger, right-clicking any of the threads in question and selecting suspend suspends the thread and displays the code currently being executed. Attempting step-into or step-over the line question appears to have no effect - the thread state changes to "Stepping" with control never returning to the debugger unless suspend is clicked again.
Thanks
6 Answers
A few minutes ago I stumbled upon this:
http://runnerwhocodes.blogspot.com/2007/10/deadlock-detection-with-eclipse.html
For me it looks like the best approach detect deadlocks (even it would not help in each case, e.g. detecting deadlocks in combination with EMT-Locks).
Comments
I don't know about eclipse but what you are looking for is a profiler. Checkout JProfiler or have a look at this list for example. The profiler connects directly to the JVM and visualizes what's going on inside your program in real time. When deadlocks occur you get visual/textual clues of which threads are in conflict.
1 Comment
I would recommend using a static analysis tool like
, which can often detect Deadlocks at compile-time