ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LECOCQ Michel (CAMPUS)" <michel.lec...@decathlon.com>
Subject RE: Stale DB-connections
Date Fri, 01 Feb 2008 11:15:24 GMT

I've tested  with the two connection factory classes (minerva and dbcp)
on mysql and oracle databases.
With minerva, no problem occured.
With DBCP, the limit of pool-maxsize value  from the datasource is not
respected and the connections increase until reaching the connections
max value defined on the database.
The db-connections are not correctly removed too.



-----Original Message-----
From: David E Jones [mailto:jonesde@hotwaxmedia.com] 
Sent: Thursday, January 31, 2008 7:10 PM
To: user@ofbiz.apache.org
Subject: Re: Stale DB-connections

This is an interesting find Hans.

Has anyone noticed, or tested, this with other databases (ie other than
MySQL which is what Hans mentions testing with)?

The big question in my mind is do we turn it off altogether, or make it
a configurable option with recommended settings for different databases?

If anyone can take a peek at their system(s) and offer feedback that
would be great.


On Jan 31, 2008, at 12:37 AM, Hans Holmlund wrote:

> I have just upgraded to the latest version of Entity Engine and 
> stumbled upon a problem. The problem I had was that db-connections 
> were dropped after awhile but without actually closing the TCP session

> with the database. So when I checked with netstat I had a lot of 
> connections in a CLOSE_WAIT state. I'm using MySQL but I guess this 
> may happen with other databases too.
> I had a look in the code and come up with a fix. In 
> DBCPConnectionFactory (row 96) there is a line saying:
>   pool.setTimeBetweenEvictionRunsMillis(600000);
> In GenericPool to set this parameter has the effect of creating an 
> eviction thread, so every 10 minutes the pool will be checked if there

> exist any unused objects. The problem seems to be when the object is 
> evicted, I'm not sure what is happening but the object is not 
> correctly removed.
> I don't think that this cleaning procedure is necessary, if I have set

> the pool-maxsize to 200 I can probably live with that the actual 
> pool-size never shrinks.
> So I made this change:
>   pool.setTimeBetweenEvictionRunsMillis(-1);
> The eviction thread will not be created. And after I made this change 
> I have not had any problems with stale DB-connections.
> / Hans Holmlund

View raw message