commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mauro Botelho <>
Subject Re: Negative value for numActive under high load
Date Wed, 04 May 2005 12:52:23 GMT

This is probably a synchronization issue. I didn't look at the code,
but what normally happen is that developers assume that the ++/--
operators are thread safe and they are not.


On 5/3/05, Ben Lindahl <> wrote:
> Hi all,
> I have an application that uses GenericObjectPool in Commons Pool.
> Under relatively high loads (perhaps 10-20 objects borrowed per second),
> one of the pools is returning a negative number of active connections
> when getNumActive is called.  A summary report on the pool shows the
> following numbers:
> Active/Max Active   -6/10
> Idle/Max Idle       10/10
> Created/Destroyed   24/20
> The last couple of values we are tracking ourselves by implementing
> connectionCreated() and connectionDestroyed().
> Besides the negative numActive, it is also strange that 20 connections
> are destroyed, even though maxIdle is set to the same thing as maxActive
> (so no more than 10 connections should be created, and therefore none
> should ever have to be destroyed).  When maxIdle==-1, the number of
> connections created is also greater than 10, but the number of
> connections destroyed is 0 and numActive is 0.  An interesting point
> about these numbers is that numActive+numIdle+numDestroyed==numCreated.
> This fact still holds true even though there are a negative number of
> active connections.
> I have tried searching the Commons Pool bug reports on this, but was
> unable to come up with anything.  I am hoping that it is an
> implementation issue on our side, so that we can fix it quickly.
> Thanks in advance.
> Ben Lindahl

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

View raw message