This is a follow-up message, for the record.

Following Antonio Fiol's kind prompting, I added the following Commons-DBCP
elements to the DataSource resource parameters specified in my application's
context fragment:

    validationQuery --> select 'x' from dual
    testWhileIdle --> true
    timeBetweenEvictionRunsMillis --> 600000
    numTestsPerEvictionRun --> 10
    minEvictableIdleTimeMillis --> 600000

And I'm glad to say that my web application has maintained its connection(s)
despite being idle for several hours, overnight. I logged in immediately
this morning.

It seems easy enough once you know how, but I suppose trying to wear both
developer and administrator hats is a bit of a tall order: there is just so
much stuff!

Good stuff, I hasten to add. Really good stuff :-)

Thanks again to Antonio, and the others who responded.

Kind regards

Harry Mantheakis
London, UK



> Hi Harry,
> 
> 
>> I'm going to try and hijack this thread if I may (!) because, as you say...
>>  
>> 
> Welcome! ;-)
> 
>> [...] The other Tomcat server runs on a Red Hat 9 machine at my home. It
>> connects
>> to the above Oracle DB box - far away - using the same static IP address.
>> 
>> [...] The problem is with the the DB connections on my own RH9 server - they
>> just
>> *die* after a period of inactivity :-(
>> 
>> That period of inactivity can be as little as half and hour.
>> [...]
>>  
>> 
> 
> Very typical behaviour... at least in our scenario.
> 
>> BTW - the 'first' login attempt (which reactivates the connection pooling)
>> never gets a response - it just times out.
>>  
>> 
> 
> Very true.
> 
>> Do you think you can shed any light on this?
>> 
> 
> I'll try.
> 
>> I have read just about every
>> single forum discussion - from Tomcat-User to Commons DBCP to you-name-it,
>> and I just cannot find the answer.
>>  
>> 
>> I have a very strict firewall policy on my Linux box - using iptables. Only
>> port 80 packets get through. Nothing else.
>> 
>> Does that have something to do with my problem? Is there an ICMP port that I
>> need to open up?
>>  
>> 
> 
> Nope. No ICMP is needed for keepalives.
> The reason of your headaches may be in /proc/sys/net/ipv4/netfilter
> There, you have several timeout values. Check
> ip_conntrack_tcp_timeout_established.
> 
> Anyway, however high you set the values in there, there will be an upper
> limit. So, I think you need to avoid your connection being idle, so that
> your firewall does not drop it, even with low timeout values. To do
> that, I suggest to use the mechanism provided by DBCP to test idle
> connections every now and then.
> 
> testWhileIdle --> true
> validationQuery --> select 'x' from dual
> timeBetweenEvictionRunsMillis --> 300000 (five minutes. Or longer, as
> far as it works...)
> 
> On Monday, I may send you out production values. Now I don't have them,
> so I worked out some ;-)
> 
> I am not sure whether you will need to set some more parameters. The
> authoritative source of information is:
> http://jakarta.apache.org/commons/dbcp/configuration.html
> 
> Other sources (link below) say that you also have to set
> numTestsPerEvictionRun. I'd suggest a value equal to maxIdle.
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg05339.html
> 
> And he also proposes another solution (which I have not tested):
> 
> ---------------------------------------------------
> You can prevent that your firewall from dropping the connection using
> a oracle technique.
> SQL*Net has a parameter which defines time interval to send a probe
> message to identify if the client process is still alive
> - SQLNET.EXPIRE_TIME, sqlnet.ora file on the server side.
> SQLNET.EXPIRE_TIME = <your_value>
> Set it to something like 30 when your firewall drops connection after
> 60 minutes.
> ---------------------------------------------------
> 
> 
> 
> 
> I hope that helped.
> 
> 
> Antonio Fiol
> 
> 
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to