commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13128] New: - GenericKeyedObjectPool: _activeMap.get(key) increment is not balanced with decrements
Date Mon, 30 Sep 2002 06:15:41 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13128>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13128

GenericKeyedObjectPool: _activeMap.get(key) increment is not balanced with decrements

           Summary: GenericKeyedObjectPool: _activeMap.get(key) increment is
                    not balanced with decrements
           Product: Commons
           Version: 1.0.1 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Pool
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: roytmana@peacetech.com


I have been having "exausted pool" problems while using DBCP. In reality there 
were zero objects in the pool and I should not have gotten this error.
While testing I found out that problem seems to be in GenericKeyedObjectPool:
while total number of connections _totalActive is perfectly balanced by calls 
to borrowObject and returnObject (and actually is zero)
number of active objects per keyed pool (I have only one) _activeMap.get(key)
does not get decremented properly under certain conditions. as a result  I have
_activeMap.get(key) greater then _totalActive. 

I put some debug output in borrow and return methods

borrowObject() {
<snip>
            } else {
                Integer active = (Integer)(_activeMap.get(key));
                if(null == active) {
                    _activeMap.put(key,new Integer(1));
                } else {
                    _activeMap.put(key,new Integer(active.intValue() + 1));
                }
                System.out.println("BORROW: totalActive=" + _totalActive + ", 
poolActive=" + active);
                _totalActive++;
                return pair.value;
            }
        }
    }

returnObject() {
<snip>
            System.out.println("RETURN: totalActive=" + _totalActive + ", 
poolActive=" + active);
            // if there's no space in the pool, flag the object
            // for destruction
            // else if we passivated succesfully, return it to the pool
            if(_maxIdle > 0 && (pool.size() >= _maxIdle)) {
                shouldDestroy = true;
            } else if(success) {
                pool.addFirst(new ObjectTimestampPair(obj));
                _totalIdle++;
            }
            notifyAll();
        }

        if(shouldDestroy) {
            try {
                _factory.destroyObject(key, obj);
            } catch(Exception e) {
                // ignored?
            }
        }
    }


and got following output:

BORROW: totalActive=0, poolActive=null
RETURN: totalActive=0, poolActive=1
BORROW: totalActive=0, poolActive=null
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=1
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=2
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=3
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=4
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=5
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=6
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=7
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=8
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=9
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=10
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=11
RETURN: totalActive=0, poolActive=null
BORROW: totalActive=0, poolActive=12
RETURN: totalActive=0, poolActive=null

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message