Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

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.