tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol BonnĂ­n <>
Subject Re: (was: similar problem) Connection Pool Dies
Date Fri, 20 Feb 2004 16:14:24 GMT
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 

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:

Other sources (link below) say that you also have to set 
numTestsPerEvictionRun. I'd suggest a value equal to maxIdle.

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

View raw message