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

[Broker-J] Incorrect check of maximum open connections

    XMLWordPrintableJSON

Details

    Description

      The AMQP port has the limit of maximum open connections. But this limit is not checked correctly. The AMQP port has two methods AmqpPort::canAcceptNewConnection and AmqpPort::incrementConnectionCount.

      Suppose that the port has the limit 5 connection and clients open 7 connections at the same time:

      1. 7 parallel connections is open by IO-threads.
      2. All threads call the AmqpPort::canAcceptNewConnection method and every thread receive the positive answer because any connection has not been registered yet.
      3. All threads call the AmqpPort::incrementConnectionCount methods. Hence the connection count is increased to 7 what breaks the limits.
      4. All 7 connections are accepted in spite of breaking limit.

      The every thread can see the intermediate state of the counter when the limit is checked by another thread but the counter has not been incremented yet.
      The solution is the combination of the steps 'check' and 'increment' into single atomic operation when every thread has the exclusive access to the counter. The counter can be observed only in two states: 'before check' or 'after incrementation'.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lacam Marek Laca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: