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 7A36DDBF3 for ; Wed, 22 May 2013 18:01:40 +0000 (UTC) Received: (qmail 8730 invoked by uid 500); 22 May 2013 18:01:37 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 8169 invoked by uid 500); 22 May 2013 18:01:37 -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 7902 invoked by uid 99); 22 May 2013 18:01:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 18:01:35 +0000 Date: Wed, 22 May 2013 18:01:35 +0000 (UTC) From: "Sarvesh Sakalanaga (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DBCP-398) DBCP hangs on common pool borrowObject when PoolableConnection is used and the underlying connection closed unexpectedly (connection resets/timouts) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-398?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Sarvesh Sakalanaga updated DBCP-398: ------------------------------------ Attachment: DBCP-398.0.patch Here is the patch. Unit tests are passing on my system and I have also veri= fied that the problem does not repro after this fix.=20 =20 > DBCP hangs on common pool borrowObject when PoolableConnection is used an= d the underlying connection closed unexpectedly (connection resets/timouts) > -------------------------------------------------------------------------= --------------------------------------------------------------------------- > > Key: DBCP-398 > URL: https://issues.apache.org/jira/browse/DBCP-398 > Project: Commons Dbcp > Issue Type: Bug > Reporter: Sarvesh Sakalanaga > Attachments: DBCP-398.0.patch > > > The bug is in org.apache.commons.dbcp.PoolableConnection as isClosed meth= od on this calls super.isClosed which returns true (as DelegatingConnection= ::isClosed { _closed || _conn.isClosed() }). Since PoolableConnection needs= to release objects to pool even if the underlying connection is closed the= isClosed method should be overridden in this class and should return _clos= ed. This _closed is the delegating connection close which will be set to fa= lse even if the underlying connection is closed (_conn.isClosed). The fix s= hould also not throw on PoolableConnection::Close method if underlying conn= ection is closed as this state is a valid state and is expected. > Also currently the way it stands the clients of PoolableConnection will/m= ay not call Close() as isClosed always returns true in this case. > Below is the stack that the thread hangs on: > =E2=97=BEwaiting on <0x00000007b5a50e48> (a org.apache.commons.pool.impl.= GenericObjectPool$Latch) > at java.lang.Object.wait(Object.java:503) > at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericOb= jectPool.java:1104) > =E2=97=BElocked <0x00000007b5a50e48> (a org.apache.commons.pool.impl.Gene= ricObjectPool$Latch) > at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSo= urce.java:106) > at org.datanucleus.store.rdbms.ConnectionProviderPriorityList.getConnect= ion(ConnectionProviderPriorityList.java:57) > at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionIm= pl.getConnection(ConnectionFactoryImpl.java:354) > at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionIm= pl.getXAResource(ConnectionFactoryImpl.java:314) > at org.datanucleus.store.connection.ConnectionManagerImpl.enlistResource= (ConnectionManagerImpl.java:386) > at org.datanucleus.store.connection.ConnectionManagerImpl.allocateConnec= tion(ConnectionManagerImpl.java:252) > at org.datanucleus.store.connection.AbstractConnectionFactory.getConnect= ion(AbstractConnectionFactory.java:60) > at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStor= eManager.java:449) > at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStor= eManager.java:418) > at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuer= y.java:595) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira