Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-564

BasicManagedDataSource leaks connections opened after transaction is rollback-only

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.0
    • 2.8.0
    • None
    • Patch

    Description

      In the following situation a connection will be leaked and never returned to the pool:

      • a BasicManagedDataSource is instantiated for a non-XA driver class name (but with a TransactionManager and a TransactionSynchronizationRegistry),
      • a transaction is started then switched to rollback-only,
      • a connection is acquired from the datasource,
      • the connection is closed,
      • the transaction is rolled back.

      The leak happens because, even though there is code in TransactionContext.addTransactionContextListener to properly use the transactionSynchronizationRegistry to register the suitable Synchronization to do cleanup in afterCompletion, the transactionSynchronizationRegistry is actually null because of the way the LocalXAConnectionFactory was created in BasicManagedDataSource.createConnectionFactory.

      PR: https://github.com/apache/commons-dbcp/pull/39

      Attachments

        Activity

          People

            Unassigned Unassigned
            fguillaume Florent Guillaume
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m