Jean-Louis Monteiro created AMQ-9693:
----------------------------------------

             Summary: 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.18.7, 6.1.6, 5.19.0
            Reporter: Jean-Louis Monteiro


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([email protected]/ThreadPoolExecutor.java:1144)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:642)
at java.lang.Thread.runWith([email protected]/Thread.java:1596)
at java.lang.Thread.run([email protected]/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: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to