Description
When a TempQueue is being torn down and it contains expired Messages its possible for a deadlock occurs if the advisory for expired Message or DLQd fires at the same time as another Destination is created on the Broker.
Found one Java-level deadlock: ============================= "ActiveMQ Transport: tcp:///127.0.0.1:53182@60490": waiting to lock monitor 0x00007f9630020c80 (object 0x00000007c4541ff0, a java.util.concurrent.ConcurrentHashMap), which is held by "ActiveMQ Transport: tcp:///127.0.0.1:53158@60490" "ActiveMQ Transport: tcp:///127.0.0.1:53158@60490": waiting for ownable synchronizer 0x00000007c4600f98, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync), which is held by "ActiveMQ Transport: tcp:///127.0.0.1:53099@60490" "ActiveMQ Transport: tcp:///127.0.0.1:53099@60490": waiting to lock monitor 0x00007f9630020c80 (object 0x00000007c4541ff0, a java.util.concurrent.ConcurrentHashMap), which is held by "ActiveMQ Transport: tcp:///127.0.0.1:53158@60490" Java stack information for the threads listed above: =================================================== "ActiveMQ Transport: tcp:///127.0.0.1:53182@60490": at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:271) - waiting to lock <0x00000007c4541ff0> (a java.util.concurrent.ConcurrentHashMap) at org.apache.activemq.broker.region.RegionBroker.addDestinationInfo(RegionBroker.java:297) at org.apache.activemq.advisory.AdvisoryBroker.addDestinationInfo(AdvisoryBroker.java:189) at org.apache.activemq.broker.BrokerFilter.addDestinationInfo(BrokerFilter.java:217) at org.apache.activemq.broker.BrokerFilter.addDestinationInfo(BrokerFilter.java:217) at org.apache.activemq.broker.MutableBrokerFilter.addDestinationInfo(MutableBrokerFilter.java:223) at org.apache.activemq.broker.TransportConnection.processAddDestination(TransportConnection.java:527) at org.apache.activemq.command.DestinationInfo.visit(DestinationInfo.java:122) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:329) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:184) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:288) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196) at java.lang.Thread.run(Thread.java:722) "ActiveMQ Transport: tcp:///127.0.0.1:53158@60490": at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007c4600f98> (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197) at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945) at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:128) at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:279) - locked <0x00000007c4541ff0> (a java.util.concurrent.ConcurrentHashMap) at org.apache.activemq.broker.region.RegionBroker.addDestinationInfo(RegionBroker.java:297) at org.apache.activemq.advisory.AdvisoryBroker.addDestinationInfo(AdvisoryBroker.java:189) at org.apache.activemq.broker.BrokerFilter.addDestinationInfo(BrokerFilter.java:217) at org.apache.activemq.broker.BrokerFilter.addDestinationInfo(BrokerFilter.java:217) at org.apache.activemq.broker.MutableBrokerFilter.addDestinationInfo(MutableBrokerFilter.java:223) at org.apache.activemq.broker.TransportConnection.processAddDestination(TransportConnection.java:527) at org.apache.activemq.command.DestinationInfo.visit(DestinationInfo.java:122) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:329) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:184) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:288) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196) at java.lang.Thread.run(Thread.java:722) "ActiveMQ Transport: tcp:///127.0.0.1:53099@60490": at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:271) - waiting to lock <0x00000007c4541ff0> (a java.util.concurrent.ConcurrentHashMap) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) at org.apache.activemq.advisory.AdvisoryBroker.addDestination(AdvisoryBroker.java:174) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:145) at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:151) at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:389) at org.apache.activemq.broker.jmx.ManagedRegionBroker.send(ManagedRegionBroker.java:282) at org.apache.activemq.advisory.AdvisoryBroker.fireAdvisory(AdvisoryBroker.java:550) at org.apache.activemq.advisory.AdvisoryBroker.messageExpired(AdvisoryBroker.java:291) at org.apache.activemq.broker.BrokerFilter.messageExpired(BrokerFilter.java:257) at org.apache.activemq.broker.BrokerFilter.messageExpired(BrokerFilter.java:257) at org.apache.activemq.broker.MutableBrokerFilter.messageExpired(MutableBrokerFilter.java:269) at org.apache.activemq.broker.region.Queue.messageExpired(Queue.java:1793) at org.apache.activemq.broker.region.Queue.messageExpired(Queue.java:1786) at org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1911) at org.apache.activemq.broker.region.Queue.doPageIn(Queue.java:1854) at org.apache.activemq.broker.region.Queue.purge(Queue.java:1244) at org.apache.activemq.broker.region.TempQueue.dispose(TempQueue.java:95) at org.apache.activemq.broker.region.AbstractTempRegion.dispose(AbstractTempRegion.java:100) - locked <0x00000007c45a8718> (a org.apache.activemq.broker.jmx.ManagedTempQueueRegion) at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:216) at org.apache.activemq.broker.region.TempQueueRegion.removeDestination(TempQueueRegion.java:63) at org.apache.activemq.broker.jmx.ManagedTempQueueRegion.removeDestination(ManagedTempQueueRegion.java:63) at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:290) at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:149) at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:202) at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:149) at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:149) at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:155) at org.apache.activemq.broker.TransportConnection.processRemoveConnection(TransportConnection.java:815) - locked <0x00000007c46b1168> (a org.apache.activemq.broker.jmx.ManagedTransportConnection) at org.apache.activemq.command.RemoveInfo.visit(RemoveInfo.java:72) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:329) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:184) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:288) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196) at java.lang.Thread.run(Thread.java:722) Found 1 deadlock. Heap PSYoungGen total 56064K, used 53316K [0x00000007c1600000, 0x00000007c8380000, 0x0000000800000000) eden space 48064K, 96% used [0x00000007c1600000,0x00000007c43411b0,0x00000007c44f0000) from space 8000K, 87% used [0x00000007c44f0000,0x00000007c4bc0000,0x00000007c4cc0000) to space 8000K, 0% used [0x00000007c7bb0000,0x00000007c7bb0000,0x00000007c8380000) ParOldGen total 128256K, used 2922K [0x0000000744200000, 0x000000074bf40000, 0x00000007c1600000) object space 128256K, 2% used [0x0000000744200000,0x00000007444daab8,0x000000074bf40000) PSPermGen total 21248K, used 13151K [0x000000073f000000, 0x00000007404c0000, 0x0000000744200000) object space 21248K, 61% used [0x000000073f000000,0x000000073fcd7eb8,0x00000007404c0000)