You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Balazs Zsoldos (JIRA)" <ji...@apache.org> on 2014/04/16 22:44:14 UTC

[jira] [Updated] (DBCP-417) BasicManagedDataSource does not free connection after transaction is commited

     [ https://issues.apache.org/jira/browse/DBCP-417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Balazs Zsoldos updated DBCP-417:
--------------------------------

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

To reproduce:

{code:java}
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.rollback();

// The managed datasource will block here as there is no available connection
userTransaction.begin();
connection = basicManagedDataSource.getConnection();
connection.close();
userTransaction.commit();
{code}

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

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

To reproduce:

{code:java}
            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.rollback();

            // The managed datasource will block here as there is no available connection
            userTransaction.begin();
            connection = basicManagedDataSource.getConnection();
            connection.close();
            userTransaction.commit();
{code}

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


> BasicManagedDataSource does not free connection after transaction is commited
> -----------------------------------------------------------------------------
>
>                 Key: DBCP-417
>                 URL: https://issues.apache.org/jira/browse/DBCP-417
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Geronimo TM and JOTM, H2Database JDBC Driver
>            Reporter: Balazs Zsoldos
>            Priority: Blocker
>
> When a JTA Transaction is commited, the Managed connection is not available again. The pool is becomes exhausted.
> To reproduce:
> {code:java}
> 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.rollback();
> // The managed datasource will block here as there is no available connection
> userTransaction.begin();
> connection = basicManagedDataSource.getConnection();
> connection.close();
> userTransaction.commit();
> {code}
> Set the priority to Blocker as BasicManagedDataSource cannot be used at all with the bug.



--
This message was sent by Atlassian JIRA
(v6.2#6252)