So I'm looking to find the reason I keep getting timeouts on my Apache 2.4 server with PHP-FPM. Here's the error:
[proxy_fcgi:error] [pid ###] (70007)The timeout
specified has expired:[client XXXXXXXX] AH01075 :
Error dispatching request to:, referer: http://address
In the following config files, I have played with every timeout I show. I have two pools in fpm:
[www]
;user and group info and listening ip and such up here
access_log = /path/to/access.log
request_terminate_timeout = 15
php_admin_value[error_log] = /path/to/error.log
php_admin_flag[log_errors] = on
and the second:
[app]
;user and group info and listening ip and such up here
access_log = /path/to/access.log
request_terminate_timeout = 300
php_admin_value[error_log] = /path/to/error.log
php_admin_flag[log_errors] = on
and my php.ini:
max_execution_time = 300
max_input_time = 300
default_socket_timeout = 300
So then my Apache config:
Timeout 80
<FilesMatch "^(some | names | of | files)\.php$">
SetHandler "proxy:fcgi://123.45.5.67:7891"
</FilesMatch>
<FilesMatch "^!(some | names | of | files)\.php$">
SetHandler "proxy:fcgi://123.45.5.67:5432"
</FilesMatch>
Obviously there's a lot more in the httpd.conf, but no timeouts are specified (except for an unrelated ProxyPass set to 300 seconds). I have read this thread: https://unix.stackexchange.com/questions/270655/how-to-find-and-edit-apache-timeout, but I've checked our patches with rpm -q --changelog httpd | less
, and there's a patch for that bug. The timeouts were also much more chaotic when I only had one pool. Anywhere from 24 seconds to 6.7 minutes (at 5Kb/s throttled upload speed; not a problem with the code, was purposefully testing). For a while it seemed like it was correlated with request_terminate_timeout
, but that correlation died.
Thanks for any help.
Best Answer
So, it turns out that it had something to do with the throttle speed. It was so low that the request was timing out. I fixed that by changing the RequestReadTimeout:
RequestReadTimeout header=20-120,MinRate=50 body=20,MinRate=50
Note this is also helpful if traffic from users is going through a proxy or firewall before getting to your server. The time between the request and the data could be significant.