commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [pool] Exception in GKOP allocate()
Date Mon, 25 May 2009 20:08:29 GMT
Mark Thomas wrote:
> Phil Steitz wrote:
>> I just saw this in one of my load tests
>> [java] java.util.NoSuchElementException
>>     [java]     at java.util.LinkedList.remove(
>>     [java]     at java.util.LinkedList.removeFirst(
>>     [java]     at
>> org.apache.commons.pool.impl.GenericKeyedObjectPool.allocate(
>>     [java]     at
>> org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(
>> Looks to me like before entering the permit-dispensing block, we need to
>> make sure there are latches left to be served in the allocation queue.
> Having looked at the code I don't see what you mean. Pretty much all of
> allocate() is inside a if (!_allocationQueue.isEmpty()) block. I'm
> having trouble seeing how you managed to hit this bug.
Now that I look at it again,  the continue should force a recheck.
>> IIRC what is going on,  this should happen (so could be unit-tested)
>> when there are n threads waiting and m instances in one of the pools,
>> with n < = m < maxActive, so they all get served from the idle pool, but
>> there is still capacity to create.
> Could you elaborate on how you think this occurred?
Now that I look carefully at the code, I don't understand it.  The 
continue after the first block should force a recheck.  I got 9 
instances of this in a run using commons-performance, with the config 
below.  There are 10 client threads in the test and the 9 exceptions 
happen right at the beginning of the test.

Platform is mac OS jdk 1.6

>  As an aside, did
> your test environment include the change in r778357?

    <!-- GenericObjectPool, AbandonedObjectPool, GenericKeyedObjectPool
         StackObjectPool, StackKeyedObjectPool, SoftReferenceObjectPool -->
    <!-- block, fail, or grow -->
    <!-- Ignored unless pool type a KeyedObjectPool -->
  <!-- Ignored unless pool type is AbandonedObjectPool -->
    <!-- constant, gaussian, or poisson -->
    <!-- none, linear, random -->
    <!-- none, oscillating (others?)-->

> Cheers,
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message