commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vivian Fonger" <vfon...@socketware.com>
Subject RE: [DBCP] Problem: Connection closes prematurely
Date Tue, 02 Sep 2003 13:58:21 GMT
Hi everyone,

I cannot find the configuration setting - "removeAbandoned" or
"removeAbandonedTimeout".  I have configured the following parameters in
GenericObjectPool:

setWhenExhaustedAction
setMaxActive
setMaxIdle
setTestOnBorrow
setTestOnReturn
setTestWhileIdle
setTimeBetweenEvictionRunsMillis
setMinEvictableIdleTimeMillis
setMaxWait

I cannot find anything regarding removeAbandoned or
removedAbandonedTimeout.  My application is using commons-pool version
1.1 distributed at 2002/05/04.  This is the error the application
trapped when the application is trying to traverse the next record in
the ResultSet:

java.sql.SQLException: Connection is closed.

        at
org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnect
ion.java:251)

        at
org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingC
onnection.java:176)

        at
com.accucast3.transaction.TransactionManager.updateTrialTable(Transactio
nManager.java:517)

        at
com.accucast3.transaction.TransactionManager.run(TransactionManager.java
:389)

        at java.util.TimerThread.mainLoop(Timer.java:430)

        at java.util.TimerThread.run(Timer.java:380)

If anyone can give me some pointers on this problem, I will really
appreciate it.  Thanks

Vivian Fonger


Vivian Fonger
Software Engineer
Socketware
vfonger@socketware.com


-----Original Message-----
From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be] 
Sent: Sunday, August 31, 2003 7:31 AM
To: Jakarta Commons Users List
Subject: Re: [DBCP] Problem: Connection closes prematurely


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
> 
> 
>
>  
>




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


Mime
View raw message