Question: Apache web-server uses all free RAM and becomes unresponsive on a Plesk server: Unable to fork new process
Applicable to:
Plesk for Linux
SymptomsApache web-server uses all free RAM and becomes unresponsive. The following error message appears in its error logfile:
- on CentOS/RHEL-based distributions: /var/log/httpd/error_log
- on Debian/Ubuntu-based distributions: /var/log/apache2/error.log
[mpm_prefork:error] [pid 12526] (12)Cannot allocate memory: AH00159: fork: Unable to fork new processCauseToo high values are set for the Apache MaxRequestWorkers and ServerLimit directives, due to which all RAM is being used by Apache and new processes cannot be spawned.
ResolutionDecrease the values of the MaxRequestWorkers and ServerLimit directives:
Note: The default value of MaxRequestWorkers and ServerLimit is 256.
For CentOS/RHEL-based distribution1.Connect to the Plesk server via SSH.
2.Find which Multi-Processing Module (MPM) is currently in use:
# httpd -V | grep MPM
Open the file /etc/httpd/conf.modules.d/01-cgi.conf in any text editor (For example, vi editor) and decrease the values of the following directives:
For MPM Event:
<IfModule mpm_event_module>
LoadModule cgid_module modules/mod_cgid.so
MaxRequestWorkers 256
ServerLimit 256
</IfModule>For MPM Prefork:<IfModule mpm_prefork_module>
LoadModule cgi_module modules/mod_cgi.so
MaxRequestWorkers 256
ServerLimit 256
</IfModule>4.Save the changes and close the file.
5.Restart the Apache service to apply the changes:
# service httpd restart
For Debian/Ubuntu-based distributions1.Connect to the Plesk server via SSH.
2.Find which Multi-Processing Module (MPM) is currently in use:
# apache2ctl -V | grep MPM
3.Change the MPM configuration:
Open the /etc/apache2/mods-enabled/mpm_event.conf in any text editor (For example, vi editor) and decrease the values of the following directives:
MaxRequestWorkers 256
ServerLimit 256Open the /etc/apache2/mods-enabled/mpm_prefork.conf file in any text editor (For example, vi editor) and decrease the values of the following directives:
MaxRequestWorkers 256
ServerLimit 2564.Save the changes and close the file.
5.Restart the Apache service to apply the changes:
# service apache2 restart