commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DBCP-433) Connection leak when SQLException is thrown while enlisting in XA transaction
Date Mon, 09 Feb 2015 09:14:36 GMT

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

Thomas Neidhart updated DBCP-433:
---------------------------------
    Attachment: TestManagedConnection.java

Attached a test that shows the failure.

The test does the following:

 * inject a faulty TransactionRegistry into the LocalXAConnectionFactory
 * the TransactionRegistry returns a Transaction which always fails when enlisting a XAResource

For the test it was necessary to use reflection, but I guess this is acceptable in this case.

I was also wondering why the connection is invalidated rather than returned to the pool. Can
the connection not be used after such an exception has happened? Did you try this out in your
environment?

> Connection leak when SQLException is thrown while enlisting in XA transaction
> -----------------------------------------------------------------------------
>
>                 Key: DBCP-433
>                 URL: https://issues.apache.org/jira/browse/DBCP-433
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: All
>            Reporter: Vladimir Konkov
>         Attachments: DBCP-433_patch.diff, TestManagedConnection.java
>
>
> In ManagedConnection when delegate connection is null new real (driver) connection is
borroved from pool. If SQLExcetion is thrown in 'TransactionContext.enlistResource()'  that
borrowed connection is lost (leaked).
> Short fail on network side may immediately exhaust the pool.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message