[ https://issues.apache.org/jira/browse/AMQ-9693?focusedWorklogId=966097&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-966097 ]
ASF GitHub Bot logged work on AMQ-9693: --------------------------------------- Author: ASF GitHub Bot Created on: 14/Apr/25 21:34 Start Date: 14/Apr/25 21:34 Worklog Time Spent: 10m Work Description: jeanouii commented on code in PR #1420: URL: https://github.com/apache/activemq/pull/1420#discussion_r2042975500 ########## activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionImpl.java: ########## @@ -64,8 +65,8 @@ public class ServerSessionImpl implements ServerSession, InboundContext, Work, D private MessageProducer messageProducer; private final ServerSessionPoolImpl pool; - private Object runControlMutex = new Object(); - private boolean runningFlag; Review Comment: This is a bit of a trick, because this avoids the lock but does not fix yet the initial issue in my opinion. There is an underlying bug revealed by this deadlock allowing another thread to be using this session to dispatch unconsumed messages from a stale session (removeFromPool). Trying to properly understand it, so I can push a more complete fix Issue Time Tracking ------------------- Worklog Id: (was: 966097) Time Spent: 0.5h (was: 20m) > DeadLock in RA ServerSessionImpl > -------------------------------- > > Key: AMQ-9693 > URL: https://issues.apache.org/jira/browse/AMQ-9693 > Project: ActiveMQ Classic > Issue Type: Bug > Components: RAR > Affects Versions: 5.19.0, 6.1.6, 5.18.7 > Reporter: Jean-Louis Monteiro > Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > I am running into a DeadLock issue with ActiveMQ Resource adapter. > The start method relies on a synchronized block (based on an instance object, > not final btw). At the same time, run() which is executed on another thread. > That thread might decide to remove the session from the pool when a session > is stale (see around line 190, the finally block). But the removeFromPool may > result in start() being called to dispatch unconsumed messages, hence > producing such deadlock > > {code:java} > java.lang.Thread.State: BLOCKED (on object monitor) > at org.apache.activemq.ra.ServerSessionImpl.start(ServerSessionImpl.java:123) > - waiting to lock <0x00000005943ea820> (a java.lang.Object) > at > org.apache.activemq.ra.ServerSessionPoolImpl.dispatchToSession(ServerSessionPoolImpl.java:274) > at > org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool(ServerSessionPoolImpl.java:235) > at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:190) > - locked <0x00000005943ea980> (a java.lang.Object) > at > org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:366) > at > org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@21.0.3/ThreadPoolExecutor.java:1144) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@21.0.3/ThreadPoolExecutor.java:642) > at java.lang.Thread.runWith(java.base@21.0.3/Thread.java:1596) > at java.lang.Thread.run(java.base@21.0.3/Thread.java:1583) > Locked ownable synchronizers: > - <0x00000005a29cc220> (a > java.util.concurrent.ThreadPoolExecutor$Worker) {code} > I will open a PR shortly to provide a simple fix. > > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org For additional commands, e-mail: issues-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact