commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabor Horvath (JIRA)" <j...@apache.org>
Subject [jira] Updated: (POOL-163) GenericKeyedObjectPool.borrowObject does not invalidate object if validateObject fails
Date Thu, 15 Apr 2010 14:06:50 GMT

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

Gabor Horvath updated POOL-163:
-------------------------------

    Comment: was deleted

(was: Thanks for the quick answer.
Yes, you are right, I also checked the allocate() method. I tried to test where the problem
comes from; not sure, however it seems all starts with this validity failure (I just put a
printStackTrace into dbcp code):

java.sql.SQLException: PooledConnection was reused, withoutits previous Connection being closed.
        at org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.getConnection(PooledConnectionImpl.java:180)
        at org.apache.commons.dbcp.datasources.KeyedCPDSConnectionFactory.validateObject(KeyedCPDSConnectionFactory.java:180)
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1197)
        at org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:181)
        at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:701)
        at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:676)
        at org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:912)
        at org.apache.torque.Torque.getConnection(Torque.java:314)
        at org.apache.torque.util.Transaction.beginOptional(Transaction.java:108)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:753)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelectVillageRecords(BasePFTreePeer.java:390)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelectVillageRecords(BasePFTreePeer.java:362)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelect(BasePFTreePeer.java:331)
        at com.barra.cp.bdo.torque.PFTreePeer.readPFTreeByUserId(PFTreePeer.java:143)
        at com.barra.cp.bdo.test.DBConnectionTest.run(DBConnectionTest.java:53)
        at java.lang.Thread.run(Thread.java:619)

And in a little while:

org.apache.torque.TorqueException: java.sql.SQLException: Invalid state, the Connection object
is closed.
        at org.apache.torque.util.Transaction.commit(Transaction.java:153)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:757)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelectVillageRecords(BasePFTreePeer.java:390)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelectVillageRecords(BasePFTreePeer.java:362)
        at com.barra.cp.bdo.torque.base.BasePFTreePeer.doSelect(BasePFTreePeer.java:331)
        at com.barra.cp.bdo.torque.PFTreePeer.readPFTreeByUserId(PFTreePeer.java:143)
        at com.barra.cp.bdo.test.DBConnectionTest.run(DBConnectionTest.java:53)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid state, the Connection object is closed.
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1699)
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.getMetaData(ConnectionJDBC2.java:2293)
        at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:346)
        at org.apache.torque.util.Transaction.commit(Transaction.java:144)
        ... 7 more
)

> GenericKeyedObjectPool.borrowObject does not invalidate object if validateObject fails
> --------------------------------------------------------------------------------------
>
>                 Key: POOL-163
>                 URL: https://issues.apache.org/jira/browse/POOL-163
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.5.4
>         Environment: Windows, java version "1.6.0_06", Torque 3.3 (DBCP 1.4, jTDS 1.2.5)
>            Reporter: Gabor Horvath
>
> GenericKeyedObjectPool.borrowObject does not invalidate object if validateObject fails
(line ~1200). I guess invalidation would be needed for objects which are not newly created
(newlyCreated flag in the code).
> Scenario:
> 1.) DB connection put into pool
> 2.) Attempt to reuse connection (borrowObject)
> 3.) Test on borrow (executing simple SQL query) fails: DB connection closed on jTDS level
but connection remains in the pool
> 4.) Subsequent attempts to reuse the connection causes "java.sql.SQLException: Invalid
state, the Connection object is closed"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message