tags:

views:

941

answers:

1

Hello,

I've recently started getting an error on our Tomcat servers : "Too Many Open Files" and the error goes on to reference the keystore file used for the server's SSL connector. Does anybody have any idea where this could be coming from ? Our server receives a considerable number of connections, but if I push the maximum acceptable connections past 150, the server won't even start (for whatever reason). Is there any way to get Tomcat to cache the keystore in memory so that connections don't have to read from the file repeatedly ?

+1  A: 

I'm going to assume that you're running on Linux, because that's where I have an answer.

First step is to check the ulimit for open files, and try to set it higher in the shell:

ulimit -n

This will probably print 1024, which is the "normal" user limit for Linux. Try setting a higher number:

ulimit -n 2048

If this succeeded, great. Put that command in your login script and you should be good to go. If not, then you need to increase the per-user limit. According to this document, the file that you want to edit is /etc/security/limits.conf

Incidentally, you're (probably) not seeing this because Tomcat keeps reading the same file. The JVM normally opens (and memory-maps) all the JAR files used by your application, and may keep open file handles for config files as well. It just happens to hit the limit when opening the keystore file.

kdgregory