错误:bash: fork: retry: Resource temporarily unavailable

     In the process of operating the server CentOS, executing some basic commands frequently reports errors:

 

[deploy@iZ942m5dzxvZ ~]$ ls
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable

      The essence of the above error message is that the Linux operating system cannot create more processes, resulting in an error. So solving this problem requires modifying Linux to allow more processes to be created. To modify the maximum number of processes in Linux, we can use ulimit -a to view some system parameters of the current Linux system.

[deploy@iZ942m5dzxvZ ~]$ 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) 30474
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65535
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) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

     Among the above parameters, we usually pay more attention to the maximum number of files that a process can open, that is, open files. The maximum number of processes that the system allows to create is the parameter max user processes. We can use ulimit -u 4096 to modify the value of max user processes, but it can only take effect in this session of the current terminal. After re-login, the system default value is still used.

     The correct way to modify is to modify the value in the /etc/security/limits.d/90-nproc.conf file.

 

$ cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent# accidental fork bombs.
# See rhbz
#432903 for reasoning.
*          soft    nproc    4096

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326505654&siteId=291194637