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

Introduction: –

Suddenly we faced the error ‘Open file limit ‘ while login on Linux server and try to run df -h or any other command. Here will see outofmemory  and resolve too many open files error.

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.

 
 

Steps to resolve too many open files error.

 
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 to fix outofmemory error.

 
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
 
 
 
 

5 thoughts on “Increase Open Files Limit to resolve Too Many Open files error and native OutOfMemory due to failed to create thread”

  1. IEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.

    IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.

    corporate training in chennai corporate training in chennai

    corporate training companies in india corporate training companies in india

    corporate training companies in chennai corporate training companies in chennai

    I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai

    Reply

Leave a Comment