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

Create/Close session in a loop causing connection to be closed and connection.close to hang after that

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.24
    • 0.26, 0.27
    • JMS AMQP 0-x
    • None

    Description

      sample test code:
      factory = ConnectionFactoryImpl.createFromURL(connectionUri);
      connection = factory.createConnection();
      connection.start();
      for (int i = 0; i < 10; i++)

      { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); session.close(); }

      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Destination destination = session.createQueue("q1");
      MessageProducer producer = session.createProducer(destination);
      session.close();
      connection.close();

      Issues observed:
      1. ConnectionClosedException is thrown from connection.createSession(...)
      2. SenderCreationException is thrown from session.createProcuder(...)
      2. the last connection.close() can hang

      Root cause:
      connection.createSession(...) -> send a begin frame
      session.close() -> send an end frame and session is removed from connection's local session collection

      When the peer sends back a begin frame, no session can be found using begin.remote-channel so the connection is closed. This causes session/producer creation to fail.

      If the peer also sends another frame (e.g. flow), it generates a NullPointerException in ConnectionEndpoint.receiveFlow() because session is null. This exception is unhandled and the thread dies. Connection.close() hangs with the following stack:
      "main" prio=10 tid=0x00007f738400a000 nid=0x1508 in Object.wait() [0x00007f738cd20000]
      java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)

      • waiting on <0x00000007d7ba3ac8> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
        at java.lang.Object.wait(Object.java:503)
        at org.apache.qpid.amqp_1_0.client.Connection.close(Connection.java:430)
      • locked <0x00000007d7ba3ac8> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
        at org.apache.qpid.amqp_1_0.jms.impl.ConnectionImpl.close(ConnectionImpl.java:385)

      Attachments

        1. QPID-5385.patch
          7 kB
          Xin Chen

        Activity

          People

            rgodfrey Robert Godfrey
            xinchen Xin Chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: