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 have a linux server running fine in prod for weeks, until our user base started to grow and our java server started to fail in many places! It turns out that all files and sockets are failing because it is returning "too many files open". I believe I have reached some sort of file opened limits.

How can I change this? The ulimit command is showing "unlimited".

Any other ideas?

I believe this limit is per process? Because I can still open files with say, vi, for example...

Here is the full ulimit output

ulimit  -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 4160
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
share|improve this question

Your limit on open files is set to 1024, not to unlimited. Change with ulimit -n for testing, and in /etc/security/limits.conf for production use.

share|improve this answer
Have hit this too many times with system defaults. – Ryaner Sep 24 '09 at 9:26

SvenW is on the money.

Just to add, if you don't want to apply a new policy system wide; For instance the user spawning the Java process also performs other duties. It might well be root. Then you may wish to edit or create a wrapper for launching your Java app which performs ulimit -nX before launching. Obviously you should toy with the value of X to find a sensible number for your requirements.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.