neng xu created DBCP-390:
----------------------------

             Summary: calling invalidObject(badConnection) damage the counting 
of the objects in the pool. 
                 Key: DBCP-390
                 URL: https://issues.apache.org/jira/browse/DBCP-390
             Project: Commons Dbcp
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: All env
            Reporter: neng xu


We are using DBCP pool.  The pattern of using DBCP pool is same as Apache DBCP 
pool example PoolingDataSourceDataSourceExample.java. When cleaning bad 
connections, I noticed that it called pool.invalidObject(object)  method to 
clean the bad connection object from the pool.  Recently we found that calling 
invalidObject(object) could damage the number of active connections of  the 
pool because this method always silently reduce the number  regardless the 
objects was removed from pool or not.  For example, when the connection object 
is null (creating database connection timeout happens),  calling 
invalidObject(badConnection) would cause the number of Active connections to be 
reduce one even the method did not remove any object from pool. This damage the 
counting of the object in the pool.  
This method should only reduce the number of the objects in the pool when it 
successfully removed an object from the pool.  
Note: I understand that we may resolve the problem by checking object is null 
(or object is in pool) before calling invalidObject() method. But I think it is 
just a first-aid solution.  


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

        

Reply via email to