In a Java threaddump I found the following:
\"TP-Processor184\" daemon prio=10 tid=0x00007f2a7c056800 nid=0x47e7 waiting for monitor entry [0x00007f2a21278000]
You are probably running into a cosmetic bug in the stack trace routines in the JVM when analyzing heavily contended locks - it may or may not be the same as this bug.
The fact is that neither of your two threads have actually managed to acquire the lock on the SharedItemStateManager
, as you can see from the fact that they are reporting waiting for monitor entry
. The bug is that further up in the stack trace in both cases they should report waiting to lock
instead of locked
.
The workaround when analyzing strange stack traces like this is to always check that a thread claiming to have locked
an object is not also waiting to acquire a lock on the same object.
(Unfortunately this analysis requires cross-referencing the line numbers in the stack trace with the source, code since there is no relationship between the figures in the waiting for monitor entry
header and the locked
line in the stack trace. As per this Oracle document, the number 0x00007f2a21278000
in the line TP-Processor184" daemon prio=10 tid=0x00007f2a7c056800 nid=0x47e7 waiting for monitor entry [0x00007f2a21278000]
refers to an estimate of the valid stack region for the thread. So it looks like a monitor ID but it isn't - and you can see that the two threads you gave are at different addresses in the stack).