You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2010/04/15 12:56:51 UTC

[jira] Commented: (POOL-163) GenericKeyedObjectPool.borrowObject does not invalidate object if validateObject fails

    [ https://issues.apache.org/jira/browse/POOL-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857273#action_12857273 ] 

Phil Steitz commented on POOL-163:
----------------------------------

Thanks for having a looking into the code, but I think your problem is likely somewhere else.  When an object borrowed from the pool fails validation it is destroyed and not returned to the pool.  The code is a little complicated, but the object being examined in lines 1195-1228 of the 1.5.4 source is either newly created or has been removed from the pool and assigned to the client thread (i.e. it is no longer in the idle object pool, so will not be returned to the current thread or any other client until it passes validation).  The actual removal from the pool happens in the allocate method, where the instance is attached to the latch associated with the client thread.
  
Can you please provide a stack trace of the exception above?


> 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