httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Steen <>
Subject [users@httpd] odd 30 second timeout when using mod_proxy_fcgi and php-fpm
Date Fri, 26 Apr 2013 17:00:50 GMT
Hi All!

We are having an issue where, if a php script is waiting for more than 30 seconds, apache
will kill the connection to php-fpm with the following error:

[Thu Apr 25 15:20:11.977250 2013] [proxy_fcgi:error] [pid 21763:tid 140634392327936] (70007)The
timeout specified has expired: [client] AH01075: Error dispatching request
to :

(That's the exact error, not cut or redacted in any way.)

The easiest way to reproduce this is to create a php script that contains only "sleep(60);".
 After 30 seconds apache will stop waiting and return an error.  

We are using apache 2.4.2 and php 5.3.6, and have things set up so that apache proxies over
to php-fpm using mod_proxy_fcgi.

Unfortunately, the error message above doesn't provide very much information.  I have turned
on debugging in php-fpm, but it only shows that the connection was terminated - no error message.
  I have increased debugging in apache (LogLevel debug trace4), but it still only shows the
message above.   

The relevant section of my config looks like this:

 ProxyTimeout 600
 Timeout 600
 RewriteCond %{REQUEST_FILENAME} \.php
 RewriteRule (.*) fcgi://localhost:9000/opt/mm/planner/current$1 [L,P,QSA]

My php configs are:

max_execution_time = 5
max_input_time = 3
memory_limit = 8192M

request_terminate_timeout = 0
request_slowlog_timeout = 0

At one point I set the request_terminate_timeout to both higher and lower than 30 seconds.
  When it was lower than 30 seconds, the script would be killed by php.  When it was higher
than 30 seconds, we would see the apache error above, and then once the request_terminate_timeout
was hit php would print a message indicating it had killed the script.   

I've even gone so far as to trawl through the apache source code.   I did find this in mod_proxy_fcgi.c:

   /* We need SOME kind of timeout here, or virtually anything will
    * cause timeout errors. */
   if (! conn->worker->s->timeout_set) {
       timeout = apr_time_from_sec(30);

Which seems to be a hard-coded 30 second timeout if no other timeout is set.   Is there a
way to set the "Connection Worker"  (I guess?) timeout?  Or is this totally the wrong thing
to be looking at?

Any help with this issue would be greatly appreciated.

Daniel Steen

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message