Issue: I faced this issue in JBoss while doing load testing. Under heavy load, jboss http connector crashed and it refused to accept any new connections. On checking logs, I found out that the root cause was “Too many open files” issue.
Resolution: “Too many open files” – this issue is a linux issue. OS enforces a limit on each process for maximum number of files that can get attached to a process. Normally the default value is 1024. (Default value can be checked using this command: “ulimit -n“) This value is not sufficient for processes like application containers.
All the files associated with given process can be seen with this command: lsof -p <pid>
More details about how can this value be changed is available on this wonderful blog post - http://tech-torch.blogspot.com/2009/07/linux-ubuntu-tomcat-too-many-open-files.html
One thing missing in this blog is that for ‘root’ user, you have to specifically mention the user name while modifying /etc/security/limits.conf file. Wild cards are not applicable for root user.
For example, following lines should be enter in /etc/security/limits.conf file for root user –
root soft nofile 4096
root hard nofile 8192