Solution for too program open files reported by Linux

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.