I have a REST service built using Jersey.
When I performed a "curl" against my REST API, the command hangs.
I ran jstack & this is a summarized output of two threads in BLOCKED state.
"pool-2-thread-11" prio=6 tid=0x01d51800 nid=0x2394
waiting for monitor entry [0x05e6f000..0x05e6fce8]
java.lang.Thread.State: BLOCKED (on object monitor)
at com.moi.DefaultImageProcessor$DownloadAndScaleCallable.call(
DefaultImageProcessor.java:168)
- waiting to lock <0x257aa440>
(com.moi.ImageUriMutexImpl$MutexImpl)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
ThreadPoolExecutor.java:885)
"pool-2-thread-10" prio=6 tid=0x01d51000 nid=0x18d0
waiting for monitor entry [0x05e1f000..0x05e1fd68]
java.lang.Thread.State: BLOCKED (on object monitor)
at com.moi.DefaultImageProcessor$DownloadAndScaleCallable.call(
DefaultImageProcessor.java:168)
- waiting to lock <0x257aa6b8>
(com.moi.ImageUriMutexImpl$MutexImpl)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
ThreadPoolExecutor.java:885)
I want to know how to read this stack dump. What signs should I look for in a deadlock ?
UPDATE I solved my problem! Basically I am doing a HttpClient 4.0 GET inside the synchronized block. The HttpClient was behaving badly & not returning & it held onto the locks. Via jstack, there were a couple of threads holding on to locks which caused the problem above. I understand now that it wasn't deadlocks so much but that my synchronized blocks were taking too long to return. Thanks. Merci.