Qpid
  1. Qpid
  2. QPID-3042

Session.attach could be sent before the connection is open.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6, 0.7, 0.8
    • Fix Version/s: 0.10
    • Component/s: Java Client
    • Labels:
      None

      Description

      This bug was discovered while investigating QPID-2994
      This bug also caused QPID-3033

      There exist a race condition where an application could create a new session (recreating due to an exception or a completely new session in the midst of failover) before the connection is open.
      This results in session attach being sent before the connection negotiation is completed. All though the connect method and the createSession method in Connection.java contends for the same lock, the connect method which acquires it early, will releases the lock when it waits (until the connection achieves OPEN state) and the createSession method waiting on the lock will get it and continue.

      Usually this only becomes an issue during failover, as during the initial connection creation, the application thread that creates the connection will wait until the connect method returns before it creates a session.
      However If an application tries to create a connection in one thread and several other threads try to create sessions from that connection, and if those threads don't coordinate properly to check if the connection is opened, then this same race condition is present.

        Activity

        Hide
        Rajith Attapattu added a comment -

        Tested as part of QPID-2994
        There is a test harness under the testkit module to test transactions during failover which should adequately cover this issue.

        Show
        Rajith Attapattu added a comment - Tested as part of QPID-2994 There is a test harness under the testkit module to test transactions during failover which should adequately cover this issue.

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development