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

[jira] [Commented] (DBCP-398) DBCP hangs on common pool borrowObject when PoolableConnection is used and the underlying connection closed unexpectedly (connection resets/timouts)

    [ https://issues.apache.org/jira/browse/DBCP-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14487459#comment-14487459 ] 

Shawn Heisey commented on DBCP-398:
-----------------------------------

I seem to be having this problem, or at least one that's very similar, with DBCP 2.1.

{noformat}
"b" prio=10 tid=0x00007fcc7450c800 nid=0x65e2 waiting on condition [0x00007fcc1bbb4000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000db121ea8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
        at org.apache.commons.pool2.impl.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:583)
        at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:442)
        at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
        at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:134)
        at com.REDACTED.idxbuild.db.Database.getConnection(Database.java:221)
        at com.REDACTED.idxbuild.db.Database.getColumnSet(Database.java:571)
        at com.REDACTED.idxbuild.solr.Chain.doReinsert(Chain.java:1332)
        - locked <0x00000000db0011c8> (a java.lang.Object)
        at com.REDACTED.idxbuild.solr.Chain.updateIndex(Chain.java:1985)
        at com.REDACTED.idxbuild.solr.Chain.run(Chain.java:2145)
{noformat}

This issue says fixed, but doesn't indicate which version.  Should I file a new issue, or sign up for the mailing list for further discussion?

I'm using mysql-connector-java-5.1.35-bin.jar for JDBC.  My validation query is "SELECT 1", and the validation timeout is 5.


> DBCP hangs on common pool borrowObject when PoolableConnection is used and 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
>    Affects Versions: 1.2, 1.3, 1.4, 2.0
>            Reporter: Sarvesh Sakalanaga
>         Attachments: DBCP-398.0.patch
>
>
> The bug is in org.apache.commons.dbcp.PoolableConnection as isClosed method 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 _closed. This _closed is the delegating connection close which will be set to false even if the underlying connection is closed (_conn.isClosed). The fix should also not throw on PoolableConnection::Close method if underlying connection is closed as this state is a valid state and is expected.
> Also currently the way it stands the clients of PoolableConnection will/may not call Close() as isClosed always returns true in this case.
> Below is the stack that the thread hangs on:
> ◾waiting 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(GenericObjectPool.java:1104)
> ◾locked <0x00000007b5a50e48> (a org.apache.commons.pool.impl.GenericObjectPool$Latch)
>  at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
>  at org.datanucleus.store.rdbms.ConnectionProviderPriorityList.getConnection(ConnectionProviderPriorityList.java:57)
>  at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:354)
>  at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getXAResource(ConnectionFactoryImpl.java:314)
>  at org.datanucleus.store.connection.ConnectionManagerImpl.enlistResource(ConnectionManagerImpl.java:386)
>  at org.datanucleus.store.connection.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:252)
>  at org.datanucleus.store.connection.AbstractConnectionFactory.getConnection(AbstractConnectionFactory.java:60)
>  at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStoreManager.java:449)
>  at org.datanucleus.store.AbstractStoreManager.getConnection(AbstractStoreManager.java:418)
>  at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:595)



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