You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@artemis.apache.org by "Justin Bertram (Jira)" <ji...@apache.org> on 2026/05/27 00:36:00 UTC

[jira] (ARTEMIS-6066) Deadlock with FederatedQueueConsumerImpl

    [ https://issues.apache.org/jira/browse/ARTEMIS-6066 ]


    Justin Bertram deleted comment on ARTEMIS-6066:
    -----------------------------------------

was (Author: jira-bot):
Commit 6794e2cfe43b345bd58171b02a11d4a832136033 in artemis's branch refs/heads/dependabot/maven/org.apache.commons-commons-configuration2-2.15.0 from Justin Bertram
[ https://gitbox.apache.org/repos/asf?p=artemis.git;h=6794e2cfe4 ]

ARTEMIS-6066 deadlock with Core federation consumer

I was unable to reproduce the deadlock with a test so static analysis
will have to suffice here. The solution has the benefit of being
alongside another bit of code that is explicitly identified as necessary
to prevent deadlocks.


> Deadlock with FederatedQueueConsumerImpl
> ----------------------------------------
>
>                 Key: ARTEMIS-6066
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-6066
>             Project: Artemis
>          Issue Type: Task
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.55.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> This deadlock was observed when using Core federation:
> {noformat}
> Found one Java-level deadlock:
> =============================
> "Thread-0 (ActiveMQ-scheduled-threads)":
>   waiting to lock monitor 0x00007f503040aa60 (object 0x000000052d4ec878, a java.lang.Object),
>   which is held by "Thread-4 (ActiveMQ-scheduled-threads)"
> "Thread-4 (ActiveMQ-scheduled-threads)":
>   waiting for ownable synchronizer 0x000000052dac7a80, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
>   which is held by "Thread-4723 (ActiveMQ-client-global-threads)"
> "Thread-4723 (ActiveMQ-client-global-threads)":
>   waiting to lock monitor 0x00007f503040aa60 (object 0x000000052d4ec878, a java.lang.Object),
>   which is held by "Thread-4 (ActiveMQ-scheduled-threads)"
> Java stack information for the threads listed above:
> ===================================================
> "Thread-0 (ActiveMQ-scheduled-threads)":
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.interruptConnectAndCloseAllSessions(ClientSessionFactoryImpl.java:486)
> 	- waiting to lock <0x000000052d4ec878> (a java.lang.Object)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.cleanup(ClientSessionFactoryImpl.java:527)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl.connect(FederatedQueueConsumerImpl.java:161)
> 	- locked <0x00000005248be880> (a org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl.lambda$scheduleConnect$0(FederatedQueueConsumerImpl.java:122)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl$$Lambda$992/0x00007f5158686000.run(Unknown Source)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(java.base@17.0.18/Executors.java:539)
> 	at java.util.concurrent.FutureTask.run(java.base@17.0.18/FutureTask.java:264)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(java.base@17.0.18/ScheduledThreadPoolExecutor.java:304)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.18/ThreadPoolExecutor.java:1136)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.18/ThreadPoolExecutor.java:635)
> 	at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120)
> "Thread-4 (ActiveMQ-scheduled-threads)":
> 	at jdk.internal.misc.Unsafe.park(java.base@17.0.18/Native Method)
> 	- parking to wait for  <0x000000052dac7a80> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
> 	at java.util.concurrent.locks.LockSupport.park(java.base@17.0.18/LockSupport.java:211)
> 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.18/AbstractQueuedSynchronizer.java:715)
> 	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.18/AbstractQueuedSynchronizer.java:938)
> 	at java.util.concurrent.locks.ReentrantLock$Sync.lock(java.base@17.0.18/ReentrantLock.java:153)
> 	at java.util.concurrent.locks.ReentrantLock.lock(java.base@17.0.18/ReentrantLock.java:322)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.lockFailover(ClientSessionFactoryImpl.java:279)
> 	at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.lockSessionCreation(ActiveMQClientProtocolManager.java:175)
> 	at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:289)
> 	at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:253)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1473)
> 	- locked <0x000000052d4ec878> (a java.lang.Object)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:834)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:359)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl.connect(FederatedQueueConsumerImpl.java:136)
> 	- locked <0x00000005248d8888> (a org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl.lambda$scheduleConnect$0(FederatedQueueConsumerImpl.java:122)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl$$Lambda$992/0x00007f5158686000.run(Unknown Source)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(java.base@17.0.18/Executors.java:539)
> 	at java.util.concurrent.FutureTask.run(java.base@17.0.18/FutureTask.java:264)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(java.base@17.0.18/ScheduledThreadPoolExecutor.java:304)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.18/ThreadPoolExecutor.java:1136)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.18/ThreadPoolExecutor.java:635)
> 	at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120)
> "Thread-4723 (ActiveMQ-client-global-threads)":
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.interruptConnectAndCloseAllSessions(ClientSessionFactoryImpl.java:486)
> 	- waiting to lock <0x000000052d4ec878> (a java.lang.Object)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.cleanup(ClientSessionFactoryImpl.java:527)
> 	at org.apache.activemq.artemis.core.server.federation.FederatedQueueConsumerImpl.connectionFailed(FederatedQueueConsumerImpl.java:345)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.callSessionFailureListeners(ClientSessionFactoryImpl.java:865)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.failoverOrReconnect(ClientSessionFactoryImpl.java:791)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.handleConnectionFailure(ClientSessionFactoryImpl.java:567)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.handleConnectionFailure(ClientSessionFactoryImpl.java:560)
> 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.connectionException(ClientSessionFactoryImpl.java:427)
> 	at org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$Listener.lambda$connectionException$1(NettyConnector.java:1261)
> 	at org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$Listener$$Lambda$1265/0x00007f5158878d20.run(Unknown Source)
> 	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:59)
> 	at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
> 	at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> 	at org.apache.activemq.artemis.utils.actors.ProcessorBase$$Lambda$532/0x00007f51583c7b50.run(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@17.0.18/ThreadPoolExecutor.java:1136)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@17.0.18/ThreadPoolExecutor.java:635)
> 	at org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:120)
> {noformat}
> The {{failoverOrReconnect()}} method is calling {{callSessionFailureListeners()}} *inside* the try block, meaning it is still holding {{newFailoverLock}} when the listeners are invoked.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org