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 39340] - [pool] Infinite loop in Evictor of GenericKeyedObjectPool
Date Wed, 19 Apr 2006 16:54:07 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39340>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39340





------- Additional Comments From stuart_brock@adp.com  2006-04-19 16:54 -------
I probably didn't characterize this issue correctly.  Here is the 
configuration code I use:

    private static final int FIVE_MINUTES = 300000;
    private static final int TEN_MINUTES = 600000;
    private static final int ONE_HOUR = 3600000;

    public void configurePool(int maxConnections, int maxIdleConnections) {
        poolConfig = new GenericKeyedObjectPool.Config();
        poolConfig.maxActive = maxConnections;
        poolConfig.maxIdle = maxIdleConnections;
        poolConfig.maxTotal = maxConnections;
        poolConfig.maxWait = ONE_MINUTE;
        poolConfig.minEvictableIdleTimeMillis = ONE_HOUR;
        poolConfig.numTestsPerEvictionRun = maxConnections;
        poolConfig.testOnBorrow = false;
        poolConfig.testOnReturn = true;
        poolConfig.testWhileIdle = true;
        poolConfig.timeBetweenEvictionRunsMillis = TEN_MINUTES;
        poolConfig.whenExhaustedAction = 
GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK;
        super.setConfig(poolConfig);
        
        // Attempt to prepopulate the pool with idle realtime and
        // delayed connection.  If the operation fails, do nothing.
        //
        try {
            for (int i = 0; i < maxIdleConnections; i++) {
                addObject("REALTIME");
                addObject("DELAYED");
            }
        } catch (Exception e) {
            
            // Attempt to pre-populate failed.  Do nothing, as connections
            // will be created as they are borrowed.
        }
        startEvictor(FIVE_MINUTES);
    }

Both maxConnections and maxIdleConnections are set to 1.  I know it doesn't 
make any sense to create a pool of one object, but who am I to question 
managements decisions.

Anyway, when the evictor thread starts, it wakes up to check for idle threads 
so frequently that it blocks access to the pool.  I debugged the 
GenericKeyedObjectPool class and it appears to be setting the "wakeup" timer 
correctly.  I just didn't have time to take it any further.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message