Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5095

Race condition between connection.close() and transaction.rollback() causes connection leak

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • JBossAS-5.0.0.CR2
    • JBossAS-4.2.2.GA
    • JCA service
    • None

    Description

      There is a race condition between the connection.close() and an asynchronous transaction completion
      (e.g. transaction timeout) that can lead to a leaked connection permit with eventual pool exhaustion
      when using track-connection-by-tx (i.e. all local resources).

      The problem is caused in the TxConnectionManager where the unregister assoication and the afterCompletion
      are not synchronized with each other. Both can see the connection as ready to return to the pool
      (one removes the handle, the other the synchronization at about the same time so they both check
      the same state) and both do it.

      The InternalManagedConnectionPool does not check for duplicate returns and uses an ArrayList to
      store connections (for the MRU behaviour). So the connection ends up in the pool twice

      This eventually causes problems like the leaked permit.

      Attachments

        Issue Links

          Activity

            People

              jpederse@redhat.com Jesper Pedersen
              adrian.brock Adrian Brock (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: