Qpid
  1. Qpid
  2. QPID-3512

ConnectionCloseTest occasionally fails on java-mms.0-9-1 profile

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.13
    • Fix Version/s: 0.13
    • Component/s: Java Client
    • Labels:
      None

      Description

      The new test ConnectionCloseTest#testConnectionCloseOnOnForcibleBrokerStop added for QPID-3453 is occasionally seen to fail on an old slow CI box.

      org.apache.qpid.test.unit.client.connection.ConnectionCloseTest (1)
      TestName: testConnectionCloseOnOnForcibleBrokerStop Duration: 0.229
      
      Cannot close connection:Error closing connection: org.apache.qpid.AMQConnectionClosedException: Error: Broker is shutting down [error code 320: connection forced]
      
      junit.framework.AssertionFailedError: Cannot close connection:Error closing connection: org.apache.qpid.AMQConnectionClosedException: Error: Broker is shutting down [error code 320: connection forced]
      at org.apache.qpid.test.unit.client.connection.ConnectionCloseTest.testConnectionCloseOnOnForcibleBrokerStop(ConnectionCloseTest.java:123)
      at org.apache.qpid.test.utils.QpidBrokerTestCase.runBare(QpidBrokerTestCase.java:238)
      at org.apache.qpid.test.utils.QpidTestCase.run(QpidTestCase.java:131)
      

        Activity

        Hide
        Keith Wall added a comment -

        The change to AMQStateManager were backout by QPID-3819. These were found to be the cause of a timeout during Connection#close().

        Show
        Keith Wall added a comment - The change to AMQStateManager were backout by QPID-3819 . These were found to be the cause of a timeout during Connection#close().
        Hide
        Robbie Gemmell added a comment -

        Changes seem reasonable to me.

        Show
        Robbie Gemmell added a comment - Changes seem reasonable to me.
        Hide
        Keith Wall added a comment -

        Hi Robbie could you review this change please?

        Show
        Keith Wall added a comment - Hi Robbie could you review this change please?
        Hide
        Keith Wall added a comment -

        This is a race condition on the client side occurring during connection close. We have two threads racing to close the connection.

        When the test passes, the IoReceiver (processing the ConnectionClose) thread on the client side that completely closes the connection before the test thread calls AMQConnection#close(). The test thread finds the AMQConnection#_closed atomic already set true so the #close call returns and the test passes.

        When the test fails, the actions of IoReceiver thread and the test thread race to close the connection. The IoReceiver thread records the cause for the connection close (AMQConnectionClosedException: Error: Broker is shutting down [error code 320: connection forced]), meanwhile the test thread tries to close the connection too. In AMQProtocolHandler#writeCommandFrameAndWaitForReply it finds that the state manager already has a saved exception (AMQConnectionClosedException) so it throws it and the test fails.

        Show
        Keith Wall added a comment - This is a race condition on the client side occurring during connection close. We have two threads racing to close the connection. When the test passes, the IoReceiver (processing the ConnectionClose) thread on the client side that completely closes the connection before the test thread calls AMQConnection#close(). The test thread finds the AMQConnection#_closed atomic already set true so the #close call returns and the test passes. When the test fails, the actions of IoReceiver thread and the test thread race to close the connection. The IoReceiver thread records the cause for the connection close (AMQConnectionClosedException: Error: Broker is shutting down [error code 320: connection forced] ), meanwhile the test thread tries to close the connection too. In AMQProtocolHandler#writeCommandFrameAndWaitForReply it finds that the state manager already has a saved exception (AMQConnectionClosedException) so it throws it and the test fails.

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            Keith Wall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development