Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I run 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

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

Edit /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.

share|improve this question
How are you starting the Java application? Are you SSHing in and then running java, or is it an /etc/init.d service? Is the java executable run directly or is something else used to spawn it (like start-stop-daemon)? Which user does it run as? What does /proc/<pid>/limits show (where <pid> is the PID of the Java application)? – mgorven Mar 25 '12 at 23:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.