commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: [DBCP] Problem: Connection closes prematurely
Date Sun, 31 Aug 2003 11:30:57 GMT
A connection is considered active when it is borrowed from the pool by 
getConnection().
The connections in the pool are idle.

maxIdle & maxActive are both caps on the number of objects idle / active.
If you try to return a connection to the pool (by calling close()) and 
the maxIdle limit is reached then the connection will be destroyed and 
not be added to the pool.

If you have enabled "removeAbandoned" then it is possible that a 
connection is reclaimed by the pool because it is considered to be 
abandoned.
This mechanism is triggered when (getNumIdle() < 2) && (getNumActive() > 
getMaxActive() - 3)
For example maxActive=20 and 18 active connections and 1 idle connection 
would trigger the "removeAbandoned".
But only the active connections that aren't used for more then 
"removeAbandonedTimeout" seconds are removed,
default (300 sec). Traversing a resultset doesn't count as being used.

If your traversal takes more then 300 sec then you can either disable 
the "removeAbandoned" or increase the "removeAbandonedTimeout".

But you are probably doing some processing while traversing the resultset.
If it takes so much time, then it's better to copy the resultset data 
first into an array, close the connection and then do the processing.

If you need more help, please include version numbers, full 
configuration parameters and maybe a stacktrace.

Hope this helps
Dirk


Vivian Fonger wrote:

>Hi everyone,
> 
>I want to know what connection is considered active and what connection
>is considered idle.  Currently, my application is using DBCP connection
>pooling and I am having problem with connection closes premarturely.
>This happen when the application is trying to traverse a resultset and
>the application is extremely busy (i.e. a lot of threads are requesting
>database connectivities to perform database actions).  I have set the
>maximum number idle connections pretty low, I am just wondering will
>that be a cause of database connection closing prematurely when the
>application is still traversing a resultset.
> 
>Vivian Fonger
> 
> 
>
>  
>




Mime
View raw message