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

Crash when closing a sender after the connection has been closed (with patch).

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: qpid-cpp-0.34
    • Fix Version/s: qpid-cpp-1.38.0
    • Component/s: C++ Client
    • Labels:
    • Environment:

      Red Hat Enterprise Linux Server release 6.7 (Santiago)

      The broker is ActiveMQ 5.13.0.
      The protocol used in AMQP 1.0.

      Description

      There will be a crash if you close your Sender after the Connection has been closed.

      To reproduce, compile and run the attached "crash_test.cc" file.

      The test program is very simple. It creates Connection, Session, and Sender instances, then closes the connection explicitly followed by closing the sender. The closing of the sender causes an exception to be thrown as the connection is dead, but that is caught.

      The crash happens when the Session object is destructed at the end of the test function. This causes the SenderContext from the sender to be destructed, which tries to close the underlying pn_link_t object to be freed, but that object refers to a deleted pn_connection_t object. The exception during Sender::close stopped the proper cleanup to be done.

      The Sender::close method calls ConnectionContext::detach to disconnect it from its session. One problem here is that the Connection::close method made the connection forget all its sessions, but the sessions still remember their connection, including the underlying proton objects. The connection tries to reconnect to the broker and resets its internal connection, causing the proton connection object to be freed. It then tells all its sessions about this, but those are forgotten earlier. This means that we end up with pn_link_t objects that refer to a deleted pn_connection_t object.

      I have a attached a patch to this jira which stops the ConnectionContext::detach method from trying to do remote actions if not connected. The row numbers in this patch assumes that the patch in QPID-7051 is already applied, which might cause some offset warnings when applying this patch.

        Attachments

        1. crash_test.cc
          0.9 kB
          Håkan Johansson
        2. qpid-7054.2.patch
          0.4 kB
          Håkan Johansson
        3. qpid-7054.patch
          0.7 kB
          Håkan Johansson

          Activity

            People

            • Assignee:
              jross Justin Ross
              Reporter:
              hakanj Håkan Johansson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: