Solution for too program open files reported by Linux
Today, an exception occurs on a Linux server in the system. Sometimes simple shell commands cannot be executed, and all sorts of strange errors can be successfully executed.
For example:
-Bash: error while loading shared libraries: libncurses. so.5: cannot open shared object file: Error 23
-Bash:/etc/profile: Too program open files in system
View the number of files allowed to be opened in the current operating system
Ulimit-n
It is found that the value is set to 163840 and the lsof | wc-l command is executed to 65528. There is a big gap between the value and the set value. Why do we still report too program open files, it suddenly occurred that there was another place to set the maximum number of files.
Use commands
Cat/proc/sys/fs/file-max
65536. At this time, I know why an occasional exception occurs. The number of files used by the current system is very close to the maximum number.
Echo 131072>/proc/sys/fs/file-max is directly increased by one factor, which can take effect immediately. However, if the operating system is restarted, it will become invalid again.
If it takes effect permanently, modify the/etc/sysctl. conf file and add fs. file-max = 131072 to it. Then run sysctl-p to take effect.
Therefore, when too program open files appears in the system, you need to check both of them.
Solve the problem.
This article permanently updates the link address: