Increase Open Files Limit to resolve Too Many Open files error and native OutOfMemory due to failed to create thread

Suddenly we faced the error 'Open file limit ' while login on Linux server and try to run df -h or any other command.


The likely cause of this issue is hitting max "Open file limit". This error indicates that all available file handles for the process have been used.

To resolve this issue we need to increase the size of ulimit -Sn. The ulimit command allow you to control user resource limit is the system such as process data size , virtual memory and process file size , no of processes etc.


Current value of ulimit -Sn is 1024. Here we need to increase the value of ulimit -Sn. 


#ulimit -Sn
1024

#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) 1031260
max locked memory       (kbytes, -l) 64
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) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1031260
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited



Increase the limit temporary.

It can be increased temporarily for the current session by setting

#ulimit -Sn 4024

#ulimit -Hn 653223


Increase the limit permanently.

For permanently we need to edit /etc/security/limits.conf for root user or non-root user as well.

#cat /etc/security/limits.conf

####setting for nofile soft limit is 1024

oracle   soft   nofile    4024
*        soft nofile  4024


### oracle-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536

oracle   hard   nofile    65536
*   hard   nofile    65536


Once you save file, you may need to logout and login again.


Finally verify the value.

[root@***** ~]# ulimit -Sn
4096

[root@***** ~]# ulimit -Hn
65536




2 comments:

Post a Comment

Thanks for reading till end. I hope this will help you more to improve your knowledge.

Now it's your turn!

What do you think? Share your experience in the comments box and subscribe for more interesting post.