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

BasicManagedDataSource does not free connection after transaction is commited

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1
    • Labels:
      None
    • Environment:

      Geronimo TM and JOTM, H2Database JDBC Driver

      Description

      When a JTA Transaction is commited, the Managed connection is not available again. The pool is becomes exhausted.

      To reproduce:

      Jotm jotm = new Jotm(true, false);
      JdbcDataSource h2DataSource = new JdbcDataSource();
      h2DataSource.setUrl("jdbc:h2:mem:test_mem");
      BasicManagedDataSource basicManagedDataSource = new BasicManagedDataSource();
      basicManagedDataSource.setTransactionManager(jotm.getTransactionManager());
      basicManagedDataSource.setXaDataSourceInstance(h2DataSource);
      basicManagedDataSource.setMaxTotal(2);
      basicManagedDataSource.setMaxIdle(2);
      
      UserTransaction userTransaction = jotm.getUserTransaction();
      userTransaction.begin();
      Connection connection = basicManagedDataSource.getConnection();
      connection.close();
      userTransaction.commit();
      
      userTransaction.begin();
      connection = basicManagedDataSource.getConnection();
      connection.close();
      userTransaction.commit();
      
      // The managed datasource will block here as there is no available connection
      userTransaction.begin();
      connection = basicManagedDataSource.getConnection();
      connection.close();
      userTransaction.commit();
      

      Set the priority to Blocker as BasicManagedDataSource cannot be used at all with the bug.

      Tested with Geronimo Transaction Manager and JOTM.

      This worked well with version 1.4.

        Attachments

        1. test-dbcp2-BasicManagedDataSource.zip
          4 kB
          Balazs Zsoldos
        2. DBCP-417.patch
          3 kB
          Phil Steitz

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              balazs.zsoldos Balazs Zsoldos
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: