proxy_fcgi timeouts but PHP-FPM doesn't

imorandin

Member
PartnerNOC
Nov 20, 2014
13
1
53
cPanel Access Level
DataCenter Provider
Hi,

I've detected that after proxy_fcgi timeouts (this is the expected behavior), PHP-FPM does not and continues processing in the background, apparently indefinitely.
To test this out, I've created a simply PHP script that executes an infinite loop and creates 100% CPU usage continuously.

I've tried adding "request_terminate_timeout: 10" into /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml, reconfiguring with /usr/local/cpanel/scripts/php_fpm_config --rebuild and restarting apache_phpfpm. The parameter is loaded because In the log the child is killed after 10 seconds:

Code:
# tail /opt/cpanel/ea-php72/root/usr/var/log/php-fpm/error.log

[13-May-2020 16:33:21] WARNING: [pool whmcs7_duckhunt_com] child 11636, script '/home/whmcs7duckhunt/public_html/burn.php' (request: "GET /burn.php?nocache") execution timed out (10.191141 sec), terminating
[13-May-2020 16:33:21] WARNING: [pool whmcs7_duckhunt_com] child 11636 exited on signal 15 (SIGTERM) after 10.197354 seconds from start
[13-May-2020 16:33:21] NOTICE: [pool whmcs7_duckhunt_com] child 11647 started
But the php-fpm processes are stuck in 100% (see attached image).

How can I set up a timeout for the PHP-FPM processes?

Thanks!,

Ignacio
 

Attachments

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,258
313
Houston
Hello,

Our documentation on managing PHP-FPM can be found here:
 

imorandin

Member
PartnerNOC
Nov 20, 2014
13
1
53
cPanel Access Level
DataCenter Provider
Thanks Lauren,

I've read the documentation but couldn't find the answer to my problem.
Do you have any idea how to control the pool's timeout?

Ignacio
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,258
313
Houston
The documentation linked gives you ALL configuration values that can be used. There are two specific timeout settings:
https://docs.cpanel.net/whm/software/multiphp-manager-for-whm/#the-system-php-fpm-configuration-tab said:
PHP-FPM Pool Options
The PHP-FPM Pool Options section allows you to set automated pools (workers) for the specified domain. If you did not previously configure these settings, the interface will display the system pool option settings.

Note:
Apache limits the performance of PHP-FPM pool options. Apache’s configuration settings for pool options must match the PHP-FPM service’s configuration settings. For more information, read our Apache vs PHP-FPM Bottleneck with Child Processes documentation.
To set a domain’s pool options, perform the following steps:

  1. Click Edit PHP-FPM. The system will open the Domain PHP-FPM Configuration interface.
  2. In the PHP-FPM Pool Options section, enter your desired options for Max Children, Process Idle Timeout, and Max Requests. The list below shows the limits and default values for each option. If you have changed the system values from their default setting, then the system will display the system values. You must enter pool option limits that are 1,000 or over without commas in the text box. We show commas in these examples for legibility.
    • Max Children — limit 1-10,000, default 5
    • Process Idle Timeout — limit 1-10,000,000, default 10
    • Max Requests — limit 1-10,000,000, default 20
  3. Click Save Configuration at the end of the form to save your changes. The system will display a success message.
Then the pool name directives for more in-depth configuration= Configuration Values of PHP-FPM | cPanel & WHM Documentation
There are also global configuration directives which apply to more than just the pool Configuration Values of PHP-FPM | cPanel & WHM Documentation

All of these contain a timeout setting but I'd assume the one you want is the Process Idle Timeout - though you'd be able to ascertain this by going through this documentation fully.