Linux error-bash:fork:retry:resource relationship between temporarily unavailable and process descriptors

Source: Internet
Author: User

Switch users on the company server, the "-bash:fork:retry:resource temporarily unavailable" error, the query that the average user can use too few processes and the file descriptor is too small, Each file describes Inode and a file, but many file descriptors also correspond to a file. The same files can be opened by different processes and can be opened multiple times by the same process. We can view the corresponding file descriptors from the system level and the process level.

One, system-level file descriptors

Related to the system level, basically by modifying the kernel parameters to achieve, modify the system file descriptor can be implemented in the following two ways:

1,/proc/sys/fs/file-max, which records the system can open the maximum number of file descriptors, we can use cat to see how many of the total, if not enough echo into a larger number, generally do not move.

Cat/proc/sys/fs/file-max

2, Method 1 is a temporary change, the system restarts after the parameters will be invalidated, so need to write to the file saved, Linux under the modified kernel parameters, modified files are in the/etc/sysctl.conf file, we need to write the following:

Fs.file-max=xxxx

Then use the SYSCTL-P command to take effect.

In addition, we can view the file descriptor in the system via the/PROC/SYS/FS/FILE-NR parameter.

Cat/proc/sys/fs/file-nr

2272 0 100000

2272: Indicates how many file descriptors are used by the current system

0: Indicates that the current system is assigned 2,272 file descriptors, and how many of them are not used.

100000: Indicates the total number of file descriptors in the system

Two, process-level file descriptors

The process-level file descriptors can be represented by the Ulimit command or through the configuration file, which can be applied in two ways:

1,ulimit-u represents the maximum number of processes that a single user can use

Ulimit-n indicates the maximum number of file descriptors that can be opened

Modify the file descriptor to pass this command:

Ulimit-shn xxxxxx, where s means "soft", means that the soft limit, is can exceed this limit, h means "hard", that the limit is not exceeded.

2, the same Method 1 is temporary, permanently valid, must be written in the configuration file, the file descriptor in the configuration file path is written in/etc/security/limits.conf

* Soft Nofile 32768 Maximum number of file descriptors that can be opened (soft limit)
* Hard Nofile 65536 maximum number of file descriptors that can be opened (rigid link)

* Soft Nproc 32768 Maximum number of processes that can be used by a single user (soft limit)
* Hard Nproc 65536 maximum number of processes that can be used by a single user (rigid limit)

Or you can write to/etc/security/limits.d/xxx-nproc.conf (created if not present)

     * soft     nproc      32768      

in/ Etc/security/limits.d/xxx-nofile.conf (created if not present) writes to
    * soft     nofile      32768      

The first column represents domain domains, can give no user restrictions, or a user group limit,* represents all user restrictions, but the root user, except the root user is not restricted. For specific use, you can use the man limits.conf to query.

This article is from the "berniem2m" blog, make sure to keep this source http://berniem2m.blog.51cto.com/9203249/1969551

Linux error-bash:fork:retry:resource relationship between temporarily unavailable and process descriptors

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.