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

Connection leak when using CPP qpid-proton client

    XMLWordPrintableJSON

    Details

      Description

      Issue is similar to QPID-8477: when broker is configured to accept limited number of connections from certain client and client is not well behaved, there is a possibility to exceed configured connection limit.

      Steps to reproduce

      1. Configure broker to allow only 1 connection

       

      3. Prepare certificates

       

      4. Install Qpid::Proton 0.28.0

      wget http://archive.apache.org/dist/qpid/proton/0.28.0/qpid-proton-0.28.0.tar.gz

      gunzip qpid-proton-0.28.0.tar.gz

      mkdir -p qpid-proton-0.28.0/build && pushd qpid-proton-0.28.0/build && cmake .. && make all && popd

      5. Replace and edit example qpid-proton-0.28.0/cpp/examples/simple_recv.cpp with the one attached

      6. Build again

      cd qpid-proton-0.28.0/build

      make

      7. Start clients

      ./cpp/examples/simple_recv & ./cpp/examples/simple_recv

       8. Check connection count
      curl http://admin_user:password@your_broker_host:http_administration_port/api/latest/querybroker/VirtualHost?select=connectionCount

      Analysis:

      Client outputs following error message:

      Connection error
      [0x1c4fac0]:unable to find an open available channel within limit of 0
      [0x1c4fac0]:process error -2

      In broker log following stacktrace is seen:

      2020-12-09 11:03:32,252 WARN  [IO-/10.112.45.3:45094] (o.a.q.s.p.v.f.FrameHandler) - Unexpected exception handling frame
      org.apache.qpid.server.util.ConnectionScopedRuntimeException: Unexpected state, client has sent frame in an illegal order.  Required state: OPENED, actual state: CLOSED
      	at org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl.assertState(AMQPConnection_1_0Impl.java:1768)
      	at org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl.receiveBegin(AMQPConnection_1_0Impl.java:701)
      	at org.apache.qpid.server.protocol.v1_0.type.transport.Begin.invoke(Begin.java:230)
      	at org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl.received(AMQPConnection_1_0Impl.java:515)
      	at org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl.receive(AMQPConnection_1_0Impl.java:480)
      	at org.apache.qpid.server.protocol.v1_0.framing.FrameHandler.parse(FrameHandler.java:224)
      	at org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl.onReceive(AMQPConnection_1_0Impl.java:1312)
      	at org.apache.qpid.server.transport.AbstractAMQPConnection.lambda$received$2(AbstractAMQPConnection.java:576)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.apache.qpid.server.transport.AbstractAMQPConnection.received(AbstractAMQPConnection.java:571)
      	at org.apache.qpid.server.transport.MultiVersionProtocolEngine.received(MultiVersionProtocolEngine.java:135)
      	at org.apache.qpid.server.transport.NonBlockingConnection.processAmqpData(NonBlockingConnection.java:611)
      	at org.apache.qpid.server.transport.NonBlockingConnectionTLSDelegate.processData(NonBlockingConnectionTLSDelegate.java:141)
      	at org.apache.qpid.server.transport.NonBlockingConnection.doRead(NonBlockingConnection.java:496)
      	at org.apache.qpid.server.transport.NonBlockingConnection.doWork(NonBlockingConnection.java:270)
      	at org.apache.qpid.server.transport.NetworkConnectionScheduler.processConnection(NetworkConnectionScheduler.java:134)
      	at org.apache.qpid.server.transport.SelectorThread$ConnectionProcessor.processConnection(SelectorThread.java:575)
      	at org.apache.qpid.server.transport.SelectorThread$SelectionTask.performSelect(SelectorThread.java:366)
      	at org.apache.qpid.server.transport.SelectorThread$SelectionTask.run(SelectorThread.java:97)
      	at org.apache.qpid.server.transport.SelectorThread.run(SelectorThread.java:533)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at org.apache.qpid.server.bytebuffer.QpidByteBufferFactory.lambda$null$0(QpidByteBufferFactory.java:464)
      	at java.lang.Thread.run(Thread.java:748)
      

       Error is triggered by following callback in qpid-proton cpp client:

      void on_connection_open (proton::connection &c) {
       c.open_session();
       }
      

      Broker receives session opening call AMQPConnection_1_0Impl.receiveBegin(). During the check whether connection is opened or not ( AMQPConnection_1_0Impl.assertState() ) an exception is thrown, which isn't handled and connection remains not closed.

       

        Attachments

        1. simple_recv.cpp
          2 kB
          Daniil Kirilyuk
        2. broker.log
          5 kB
          Daniil Kirilyuk

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                daniel.kirilyuk Daniil Kirilyuk
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: