Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-390

calling invalidObject(badConnection) damage the counting of the objects in the pool.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.4
    • None
    • None
    • All env

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              neng1998 neng xu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: