You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ben Lindahl <be...@appiancorp.com> on 2005/05/03 21:43:48 UTC

Negative value for numActive under high load

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

 


Re: Negative value for numActive under high load

Posted by Mauro Botelho <ma...@gmail.com>.
Ben,

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.

Mauro

On 5/3/05, Ben Lindahl <be...@appiancorp.com> 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org