On Fri, Apr 26, 2013 at 6:00 PM, Daniel Steen
<[email protected]> wrote:
> 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
> 172.16.131.26:47588] 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:
>
> php.ini:
> max_execution_time = 5
> max_input_time = 3
> memory_limit = 8192M
>
> php-fpm.conf:
> 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?
You can use ProxySet to set properties of individual proxy workers.
I'm not exactly sure of the syntax when proxying via a rewrite rule,
but I think something like this is correct:
RewriteCond %{REQUEST_FILENAME} \.php
RewriteRule (.*) fcgi://localhost:9000/opt/mm/planner/current$1 [L,P,QSA]
<Proxy fcgi://localhost:9000>
ProxySet timeout=600
</Proxy>
There may also be a bug in that it seems that ProxyTimeout is not
considered when calculating the mod_proxy_fcgi timeout, only the
timeout set on the proxy worker is looked at.
Cheers
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]