2

I've stumbled upon weird situation, the java thread dump shows that a thread is waiting to lock an object, but object is not locked by any other thread. Here is a snippet from thread dump:

"PacketPublisher" #18 daemon prio=10 os_prio=2 tid=0x0000000059adf800 nid=0x1ca0 waiting for monitor entry [0x000000005bbce000]
java.lang.Thread.State: BLOCKED (on object monitor)
  at com.tangosol.coherence.component.net.socket.UdpSocket.send(UdpSocket.CDB:21)
  - waiting to lock <0x00000000a00aea00> (a java.net.DatagramPacket)
  at com.tangosol.coherence.component.net.PacketBundle.send(PacketBundle.CDB:1)
  at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.onPacket(PacketPublisher.CDB:87)
  at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.onNotify(PacketPublisher.CDB:44)
  at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:51)
  at java.lang.Thread.run(Thread.java:745)

And in the threaddump there are no other occurrences of locks on 0x00000000a00aea00 object. How it is possible?

Background: this a Coherence 12.1.3 application running on JDK 1.8u60. This situation is not temporal, when I do more thread dumps this thread is still blocked. I have to restart the application to make it work again, and sometime it works without blocking, so it's not deterministic. I also wasn't able to reproduce it on JDK 1.7u79. If you can explain how it could have happen that a thread waits forever for object that is not locked, than maybe I can figure out what's wrong in my app or in Coherence.

Wojciech Gdela
  • 359
  • 2
  • 9

1 Answers1

1

Sometimes garbage collection and class loading can cause a thread to be shown in a blocked state even when another application thread does not hold the object monitor. (However, I don't know why you see the problem with a 1.8 JVM and not with a 1.7 JVM.)

Here's a similar question with some answers that may offer some clues:

Java thread dump: BLOCKED thread without "waiting to lock ..."

Community
  • 1
  • 1
Monz
  • 321
  • 2
  • 11