Log contains the error message "fork: Cannot allocate memory".
There are too many processes. If a new process is created after the
pid_max value is reached, the error message "fork: Cannot allocate memory" will appear.
sysctl -a | grep pid_max
Perform corresponding operations according to the returned result:
pid_maxis 32768, go to the next step.
echo 42768 > /proc/sys/kernel/pid_max
Run the following command again to get the value of
3. Run the following command to view the total number of processes.
pstree -p | wc -l
When the total number of processes has reached
pid_max, a new process will cause the "fork: Cannot allocate memory" error.
4. Change the `kernel.pid_max` value in the `/etc/sysctl.conf` configuration file to `65535` to increase the number of processes. The result should be as follows:Note
You can use the
ps -efLcommand to locate the programs for which many processes are running.
5. Run the following command for the configuration to take effect immediately.