Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4441

Race condition in PooledConnectionFactory.createConnection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.8.0
    • 5.9.0
    • Pool
    • None

    Description

      `PooledConnectionFactory.createConnection(String userName, String password)` can return broken Connection. By `broken` I mean PooledConnection with referenceCount==1, but without underlying ActiveMQConnection.
      The problem is in lines

      connection = connectionsPool.borrowObject(key);
      ...
      return new PooledConnection(connection);
      

      While method `borrowObject` validates the connection and `new PooledConnection` increments referenceCount, it's possible that some thread calls `ConnectionPool.decrementReferenceCount()` just between `borrowObject` and `new PooledConnection`. referenceCount at this stage can be a zero and the ConnectionPool became closed just prior to `new PooledConnection`.

      Attachments

        1. AMQ_4441.java
          2 kB
          Andrei N.Sobchuck

        Activity

          People

            tabish Timothy A. Bish
            andrei.sobchuck Andrei N.Sobchuck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: