You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Barry Roberts <bl...@robertsr.us> on 2006/02/03 21:59:51 UTC

Tomcat 5.0.25 running out of file handles

I've been investigating why some of my tomcat servers run out of file
handles when ther'es a problem with the database and connections start
backing up.  I've discovered some things that have me scratching my
head, and I'm hoping someone can help me come up with at least an
explanation, maybe even a solution.

First, I've got 4 Apache 2.0.46 on RedHat ES 3 in the DMZ.  Their
MaxClients are set to 200, and they are using mod_jk2 2.0.4 that I
compiled from source..  I've got 8 tomcat 5.0.25 servers on ES3 (IBM
1.4.2 JDK) on the internal network with their AJP connectors
configured like this:

    <Connector port="10818" 
               maxThreads="800" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" debug="0" acceptCount=
"100"
               protocol="AJP/1.3" />


Right now, everything's running fine, and if I do this on a web server:

lsof | grep -c  10\.168\.2\.33 - 

(where 10.168.2.33 is a tomcat server) I get 27 on one particular web
server.  However, if I then on the 10.168.2.33 tomcat server do this:

lsof | grep -c 207\.14\.x\.x

where 207.14.x.x is the web server I used previously, I get 5771.
Without the -c on the grep, there are LOTS of lines like this coming
from lsof:

java      15371    tcat  232u  IPv4  185883929                  TCP xsappe:10818->207.14.x.x:37082 (ESTABLISHED)

Just with different port numbers on the web server side.

Is lsof not telling me what I think it is, or does tomcat really have
nearly 6000 file handles sitting around while the web server thinks it
only has 27 connections to tomcat?  That seems like a problem to me,
but I'm not sure my methodology is 100% correct.

The reason I'm looking into this, is in the past when we've had
database problems and reqeusts get backed up in the tomcat servers,
they appear to run out of file handles.  They can't get connections to
the db, can't write to files, etc.  I did an lsof right after that had
happened and then gone away (no re-start of tomcat).  The output of
that lsof re-directed to a file has 693495 lines, 437382 of which
match 10818 according to grep.  I'm trying to figure out if and why
tomcat is using all these file handles.  Or if I'm just
mis-interpreting lsof.

Any suggestions would be greatly appreciated.

Thanks,
Barry Roberts

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org