Java thread blocked waiting for a monitor that it owns
Issue
- Thread dump shows a thread that is blocked waiting for a monitor that it has already acquired. For example:
"EJB default - 123" #789 prio=5 os_prio=0 tid=0x00000000162d9000 nid=0x661f waiting for monitor entry [0x00002b02189e5000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.jboss.remoting3.remote.RemoteConnection$RemoteWriteListener.send(RemoteConnection.java:294)
- waiting to lock <0x000000061df0b460> (a java.util.ArrayDeque)
at org.jboss.remoting3.remote.RemoteConnection.send(RemoteConnection.java:122)
at org.jboss.remoting3.remote.OutboundMessage$1.accept(OutboundMessage.java:154)
at org.xnio.streams.BufferPipeOutputStream.send(BufferPipeOutputStream.java:126)
at org.xnio.streams.BufferPipeOutputStream.send(BufferPipeOutputStream.java:119)
at org.xnio.streams.BufferPipeOutputStream.flush(BufferPipeOutputStream.java:143)
- eliminated 0x00000005f556b230> (a org.xnio.streams.BufferPipeOutputStream)
at org.xnio.streams.BufferPipeOutputStream.close(BufferPipeOutputStream.java:161)
- locked <0x00000005f556b230> (a org.xnio.streams.BufferPipeOutputStream)
at org.jboss.remoting3.remote.OutboundMessage.close(OutboundMessage.java:283)
- locked <0x00000005f556b230> (a org.xnio.streams.BufferPipeOutputStream)
at java.io.FilterOutputStream.close(FilterOutputStream.java:159)
at org.xnio.IoUtils.safeClose(IoUtils.java:137)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.writeMethodInvocationResponse(MethodInvocationMessageHandler.java:368)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$600(MethodInvocationMessageHandler.java:68)
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:238)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
- Another example:
"JMX server connection timeout 299" daemon prio=10 tid=0x00002aaac9002800 nid=0x5e24 in Object.wait() [0x000000004f4f4000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000062cedb798> (a [I)
at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(ServerCommunicatorAdmin.java:150)
- locked <0x000000062cedb798> (a [I)
at java.lang.Thread.run(Thread.java:662)
Environment
- OpenJDK
- Oracle JDK
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.