Qpid
  1. Qpid
  2. QPID-3697

SortedQueue synchronization causes deadlock

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.5, 0.15
    • Fix Version/s: 0.15
    • Component/s: Java Broker
    • Labels:
      None
    • Environment:

      All

      Description

      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.

        Activity

        Hide
        Robbie Gemmell added a comment -

        Change looks good to me.

        Show
        Robbie Gemmell added a comment - Change looks good to me.
        Hide
        Keith Wall added a comment -

        Patch applied.

        Show
        Keith Wall added a comment - Patch applied.

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            Philip Harvey
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development