Plesk

Apache web-server uses all free RAM and becomes unresponsive on a Plesk server: Unable to fork new process

Symptoms

Apache web-server uses all free RAM and becomes unresponsive. The following error message appears in its error logfile:

[mpm_prefork:error] [pid 12526] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process

Cause

Too 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.

Resolution

Decrease the values of the MaxRequestWorkers and ServerLimit directives:

Note: The default value of MaxRequestWorkers and ServerLimit is 256.

 

For CentOS/RHEL-based distribution

 

  1. Connect to the Plesk server via SSH.

  2. Find which Multi-Processing Module (MPM) is currently in use:

    # httpd -V | grep MPM

  3. 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 distributions

 

  1. 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:

    • For MPM Event:

      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 256

    • For MPM Prefork:

      Open 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 256

  4. Save the changes and close the file.

  5. Restart the Apache service to apply the changes:

    # service apache2 restart

 

Exit mobile version