Tag Archives: linux. -bash: fork: retry: Resource temporarily unavailable

Linux. bash: fork: retry: Resource temporarily unavailable error

How is 618 sales champion made?Uncover the secret of e-commerce’s “invigorating” hundreds of millions of sales data>>>

After switching users or logging in to the server, execute LS command to report an error

1 -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 errors

Modify the maximum number of Linux processes

We can view some system parameters of the current Linux system through ulimit – A

 1 $ ulimit -a
 2 core file size          (blocks, -c) 0
 3 data seg size           (kbytes, -d) unlimited
 4 scheduling priority             (-e) 0
 5 file size               (blocks, -f) unlimited
 6 pending signals                 (-i) 62357
 7 max locked memory       (kbytes, -l) 64
 8 max memory size         (kbytes, -m) unlimited
 9 open files                      (-n) 65536
10 pipe size            (512 bytes, -p) 8
11 POSIX message queues     (bytes, -q) 819200
12 real-time priority              (-r) 0
13 stack size              (kbytes, -s) 10240
14 cpu time               (seconds, -t) unlimited
15 max user processes              (-u) 1024
16 virtual memory          (kbytes, -v) unlimited
17 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 allowed by the system 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, and the system default value will still be used after re login
the correct way to modify is to modify the values in the/etc/security/limits.d/90-nproc.conf file

1 # Default limit for number of user's processes to prevent
2 # accidental fork bombs.
3 # See rhbz #432903 for reasoning.
4 
5  *          soft    nproc     9988
6 root       soft    nproc     unlimited

We just need to modify the value of 9988 in the above file