we are having a problem with the maximum limit of open file descriptors. After configuring the server with the settings mentioned below we test to see if the the max open file descriptor is set to 10000 right after a reboot to see if the settings remain like so,
ulimit -Hn and
ulimit -Sn or
ulimit -a. The values reported (10000) are correct.
When we run our java application, we hit a maximum of 4096 open file descriptors until we get java.net.ConnectException.
watch -n 1 -x cat /proc/sys/fs/file-nr to check the number of open files and it report 4448 when the exception occurs which is normal, because before running the jar there are 352 reported.
The kernel being run is in the title of this post Ubuntu 11.04 (GNU/Linux 2.6.38-8-virtual x86_64) and i'm wondering if this could be the problem?
We have configured the following on our system
Add the following 2 lines to the file. The asterisk simply means that the rule will apply to all users.
root soft nofile 10000 root hard nofile 10000 (our ssh user) soft nofile 10000 (our ssh user) hard nofile 10000
Add the following line:
session required pam_limits.so
Save the file and exit.
Increase the maximum number of open files by setting a new value in kernel variable
/proc/sys/fs/file-max as follows (login as the root):
sysctl -w fs.file-max=65000
/etc/sysctl.conf file and append the following line so that after reboot the setting will remain as it is:
fs.file-max = 65000
Reboot the server to apply changes.