Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-5117

Java client deadlocks if connection is closed while onMessage() is creating a session

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.22
    • 0.31
    • JMS AMQP 0-x
    • None

    Description

      I have run the java systests with the JCarder agent attached. JCarder detected a potential deadlock when the following are done concurrently:

      • Application thread closes a connection
      • A MessageListener creates a new session on that connection inside onMessage().

      Here is a sketch of the wrongly-ordered locking:

      Thread "main"
      	AMQConnection.close()
      		AMQConnection.doClose()
      			lock AMQConnection._sessionCreationLock
      			lock AMQSession.getMessageDeliveryLock()
      
      Thread "Dispatcher-1-Conn-780"
      	AMQSession$Dispatcher.dispatchMessage()
      		lock AMQSession.this._messageDeliveryLock
      		myMessageListener.onMessage()
      			AMQConnection.createSession()
      				lock AMQConnection._sessionCreationLock
      

      I've attached JCarder's GraphViz-format .dot file which represents this slightly more comprehensively.

      Attachments

        1. jcarder_result_2.dot
          0.7 kB
          Phil Harvey
        2. test_QPID5117.java
          3 kB
          Pavel Moravec

        Issue Links

          Activity

            People

              Unassigned Unassigned
              philharveyonline Phil Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: