Is there any mechanism within the Eclipse debugging environment to see the state of synchronization locks held and processes waiting?
-
Are you debugging a possible dead-lock?aioobe– aioobe2010-05-03 09:34:45 +00:00Commented May 3, 2010 at 9:34
-
I found an unexpected deadlock, but I had to "guess" that might be the case from the set of inexplicably stalled processes. There ought to be a better way.ddyer– ddyer2010-05-03 10:00:32 +00:00Commented May 3, 2010 at 10:00
Add a comment
|
3 Answers
You can show the state of object monitors in Eclipse's debugger. You can find a short, clear tutorial here. For each thread, Eclipse can show you the monitors the thread owns and those it is waiting for.
Update 2020-01-20: The link above no longer works. Here's a link to cached version on the Internet Archive.
5 Comments
ddyer
Thanks. I can't imagine why the monitors view is off by default.
Scheintod
It may be, that this only works if you are looking for a deadlock caused by a synchronized statement. I'm currently looking for one caused by an
ReentrantReadWriteLock and I don't get this kind of information form eclipse.TMG
the link is broken,
eclipsezone.com doesn't seem to exist anymoreT .
@TMG I've updated the answer with a link to the Internet Archive cached version. I don't know if the article is already outdated now or not, it's quite old.
T .
I'm also not sure if I'm allowed to copy-paste the contents into my answer or not...
As suggested here you could (if you run the Sun JVM) perform the following steps:
- launch jconsole or jvisualvm (both present in the bin-directory of your JDK-installation,
- attach to the process you suspect has locked up
- go to the Threads pane. There is a "Detect Deadlock" button