Apache proxfy_fcgi - Error dispatching request to
Asked Answered
R

8

31

I have cloud hosting on Google, it sucks for to be honest but I am trying to get on with it, I installed LAMP stack on a VM and put my website in htdocs. When I try to access my site it gives me request timeout but sometimes it works for 5 minute or so.

When I see apache error logs , it gives me this

075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:55.185819 2015] [proxy_fcgi:error] [pid 4995:tid 140183521683200] (70007)The timeout specified has expired: [client 162.158.255.169:34198] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:55.487458 2015] [core:notice] [pid 2953:tid 140183785137920] AH00052: child pid 4995 exit signal Segmentation fault (11)
[Tue Oct 27 18:12:55.787973 2015] [proxy_fcgi:error] [pid 5063:tid 140183530075904] (70007)The timeout specified has expired: [client 199.27.133.137:13151] AH01075: Error dispatching request to : (polling), referer: http://whichtube.com/watch/g9-4dCeFQng/allama-nasir-abbas-jawab-ali-as-nae-talwar-kayou-na-uthai.html
[Tue Oct 27 18:12:57.542883 2015] [proxy_fcgi:error] [pid 5329:tid 140183521683200] (70007)The timeout specified has expired: [client 173.245.56.198:51348] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:57.976752 2015] [proxy_fcgi:error] [pid 5063:tid 140183479719680] (70007)The timeout specified has expired: [client 173.245.56.198:63779] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:58.993666 2015] [proxy_fcgi:error] [pid 5194:tid 140183496505088] (70007)The timeout specified has expired: [client 162.158.255.141:16226] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:12:59.196701 2015] [proxy_fcgi:error] [pid 5329:tid 140183513290496] (70007)The timeout specified has expired: [client 173.245.56.198:32819] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:01.462039 2015] [proxy_fcgi:error] [pid 5329:tid 140183504897792] (70007)The timeout specified has expired: [client 199.27.128.166:48057] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:07.518999 2015] [proxy_fcgi:error] [pid 5063:tid 140183471326976] (70007)The timeout specified has expired: [client 173.245.56.198:13694] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:16.804990 2015] [proxy_fcgi:error] [pid 5261:tid 140183513290496] (70007)The timeout specified has expired: [client 199.27.128.134:28694] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:33.055860 2015] [proxy_fcgi:error] [pid 5328:tid 140183236331264] (70007)The timeout specified has expired: [client 39.41.139.220:52154] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:57.391361 2015] [proxy_fcgi:error] [pid 5063:tid 140183521683200] (70007)The timeout specified has expired: [client 39.41.139.220:52029] AH01075: Error dispatching request to : (polling)
[Tue Oct 27 18:13:57.552542 2015] [core:notice] [pid 2953:tid 140183785137920] AH00052: child pid 5063 exit signal Segmentation fault (11)

My website is in PHP, I haven't changed anything else other than directory permission, Is there something I am missing ?

Reyesreykjavik answered 27/10, 2015 at 18:29 Comment(0)
L
20

I was having the same problem, turns out Apache has module that handles timeouts called mod_reqtimeout

The default value (you won't see it in the default http.conf) is:

RequestReadTimeout handshake=0 header=20-40,MinRate=500 body=20,MinRate=500

In my case I was uploading a file through a plain HTML form submission, so the file is technically part of the header and the default configuration says that the header will timeout at 20 to 40 seconds. The 20-40 thing is pretty cool because it will timeout at 20 seconds but if 500 bytes are sent in a second, it will add an additional second of wait time until it reaches 40 seconds and then timeout no matter what.

I upload larger files in my website so I added this line to my httpd.conf file:

RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500

So as long as my user is sending data at a minimum of 500 bytes/s, the request will not time out until a max. of 600 seconds is reached (better read the documentation, don't quote me on the throughput rate)

It's actually a pretty cool Apache module but not super well known as people recommend to change other apache timeout settings in other similar "The timeout specified has expired:" problems related to PHP-FPM but this problem happens with any post that takes more than 40 seconds to be submitted by default in Apache.

Laplace answered 15/5, 2019 at 21:42 Comment(3)
The AH01075 error message from proxy_fcgi is saying that the request being proxied to php-fpm has timed out, presumably because ProxyTimeout has been exceeded. Are you saying that you see this same error when RequestReadTimeout is triggered? I ask because I would instead expect to see something like "Request body read timeout" if RequestReadTimeout were involved.Preparation
@Preparation the exact error I got was: [Fri May 10 13:19:41.073170 2019] [proxy_fcgi:error] [pid 26964:tid 140276668856064] (70007)The timeout specified has expired: [client 201.17.156.113:2022] AH01075: Error dispatching request to : (reading input brigade), referer: https://siste.. This timeout was caused because the file the user uploaded to my php script (which is sent in the POST headers actually), took longer than the default value so it timed out.Berneicebernelle
beware that handshake variable are not available until Apache version 2.4.39Coplin
S
10

It appears that your PHP code is taking longer than the configured timeout to complete. When apache loads a PHP page using fcgi it sends the request of to PHP-FPM service to be processed. If PHP-FPM takes too long to respond then you will see this type of timeout. Possible causes are; your PHP code could be stuck in a loop, or waiting on a response from a database that is taking a particularly long time.

To troubleshoot I would use the CLI version of php to see if the script completes in a reasonable amount of time ($ time php /path/to/file.php). There may additional information in the PHP-FPM log (default: /var/log/php-fpm.log).

Straitlaced answered 11/11, 2016 at 9:53 Comment(0)
C
8

For me a restart of php-fpm did the job. After looking in the log as @varlogtim adviced. The log showed that there was no activity for the last 12 hours...

Cranston answered 3/1, 2019 at 15:20 Comment(0)
E
3

I had this problem, too. You may want to looking for a hard-code part and a connection to another unavailable server, in your code. (for example a local IP which is not accessible online).

For mine, I checked php-fpm.log on my server and I found my application is trying to connect to an old server (wrong IP) and it faces with timed out.

Eyestalk answered 8/1, 2018 at 15:47 Comment(0)
E
2

I faced this exact problem. I solved the problem by increasing timeout. My OS is AlmaLinux 8.5. Add the following two lines either in your httpd.conf or your virtualhost conf file.

Timeout 600

ProxyTimeout 600

Erose answered 15/6, 2022 at 8:1 Comment(0)
K
1

I had the same problem and in my case this solution worked:

  • increase request_terminate_timeout value located in my /etc/php-fpm.d/www.conf file.

Note: This option overrides php max_execution_time ini option and setting a low value for it could make you a lot of troubles because it will override other options and forcefully kill the request if the timeout expires. (If you ask which value to set; it should be max script proccesing time based on your needs but normally 600s(10minutes) or 10m(10minutes) is more than enouph.)

Knave answered 11/6, 2020 at 11:5 Comment(0)
P
0

I had the same problem and in my case the solution posted by Roberto Ibarra worked.

I had the errors:

/var/log/php8.1-fpm.log
.......execution timed out (63.395915 sec), terminating

/var/log/apache2/sitenamexxxx_error_log

[Tue Mar 05 16:33:12.625599 2024] [proxy_fcgi:error] [pid 262376:tid 140090231719488] [client xx.xx.xx.xxxx:59735] AH01067: Failed to read FastCGI header, referer:

[Tue Mar 05 16:33:12.625645 2024] [proxy_fcgi:error] [pid 262376:tid 140090231719488] (104)Connection reset by peer: [client xx.xx.xx.xxxx:59735] AH01075: Error dispatching request to : , referer

I modified the file: /etc/apache2/mods-enabled/reqtimeout.conf

RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500

Restarted Apache and php8.1-fpm.

Thank you. Hope can help .

Perturb answered 6/3 at 16:29 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Berna
U
-3

I had the same problem on Centos 7 : problem with SELINUX. You can temporary disable SELINUX to check : sudo setenforce 0

Uriisa answered 9/9, 2020 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.