Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC573FF6C for ; Wed, 17 Apr 2013 21:57:17 +0000 (UTC) Received: (qmail 17147 invoked by uid 500); 17 Apr 2013 21:57:17 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 17030 invoked by uid 500); 17 Apr 2013 21:57:17 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 16858 invoked by uid 99); 17 Apr 2013 21:57:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Apr 2013 21:57:17 +0000 Date: Wed, 17 Apr 2013 21:57:16 +0000 (UTC) From: "Florent Guillaume (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DBCP-355) DataSourceXAConnectionFactory does not store the XAConnection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Florent Guillaume updated DBCP-355: ----------------------------------- Attachment: DBCP-355.diff Hi, I've been hit by this problem as well. I'm attaching a patch on top of 1.4, including a unit test for it. Regards > DataSourceXAConnectionFactory does not store the XAConnection > ------------------------------------------------------------- > > Key: DBCP-355 > URL: https://issues.apache.org/jira/browse/DBCP-355 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.3, 1.4 > Environment: MysqlXADataSource passed to BasicManagedDataSource > Reporter: Clement Pang > Fix For: 1.3.1, 1.4.1 > > Attachments: DBCP-355.diff > > > We have been diagnosing a leak with DBCP and XA mySQL and discovered that the mySQL driver expects close() to be invoked on the XAConnection obtained from xaDataSource.getXAConnection() instead of the java.sql.Connection returned by xaConnection.getConnection(); > The following code snippet in DataSourceXAConnectionFactory illustrates how the XAConnection is lost: > public Connection createConnection() throws SQLException { > // create a new XAConection > XAConnection xaConnection; > if (username == null) { > xaConnection = xaDataSource.getXAConnection(); > } else { > xaConnection = xaDataSource.getXAConnection(username, password); > } > // get the real connection and XAResource from the connection > Connection connection = xaConnection.getConnection(); > XAResource xaResource = xaConnection.getXAResource(); > // register the xa resource for the connection > transactionRegistry.registerConnection(connection, xaResource); > return connection; > } > In the code snippet above, the XAConnection is basically discarded after using it to obtain the java.sql.Connection and XAResource. It would be ideal if it actually associates the XAConnection in the transactionRegistry as well so that when PooledManagedConnection handles reallyClose(), it can also invoke close() on the XAConnection by interrogating the TransactionRegistry for the actual XAConnection to close. > This may be something that's mySQL specific. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira