SortedQueue synchronization causes deadlock
-------------------------------------------

                 Key: QPID-3697
                 URL: https://issues.apache.org/jira/browse/QPID-3697
             Project: Qpid
          Issue Type: Bug
          Components: Java Broker
    Affects Versions: 0.5, 0.15
         Environment: All
            Reporter: Philip Harvey


We've seen a broker become unresponsive several times in Production.

Analysis of a thread dump showed a deadlock between two threads, namely:

- a thread that is calling SortedQueue.enqueue, which has already locked the 
SortedQueue and is trying to lock the Subscription's sendLock
- a thread that is closing a session by calling 
AMQChannel.unsubscribeAllConsumers, which has already locked the Subscription's 
sendLock and is trying to lock the SortedQueue.

The suggested fix is for SortedQueue.enqueue to not be synchronized, thereby 
removing the possibility of this deadlock occuring. SortedQueue.enqueue should 
instead lock on a private Object.

Note that SortedQueue is the only queue that is susceptible to this deadlock 
because it is the only one that has a synchronized enqueue method.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscr...@qpid.apache.org

Reply via email to