You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/05/15 08:47:07 UTC

[Bug 54973] New: mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

            Bug ID: 54973
           Summary: mod_proxy_fcgi does not honnor Timeout / ProxyTimeout
           Product: Apache httpd-2
           Version: 2.4.4
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_proxy_fcgi
          Assignee: bugs@httpd.apache.org
          Reporter: bruno.canet@b-source.ch
    Classification: Unclassified

mod_proxy_fcgi is configured to proxy request to php-fpm as follow:
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/opt/httpd/htdocs/app/$1

If a php script takes more than 30 seconds to execute, a HTTP RC 500 is
returned to the client.

php max_execution_time is set to 300 seconds 

I used the following script to validate that the error was not due to php
max_execution_time issue.

<?php
    error_log("executing script... ");
    $time = time();
    for ($t = 0; $t <= 15; $t++) {
        error_log("Logging: $t (".(time()-$time)." seconds)");
        sleep(5);
    }
    error_log("execution done (".(time()-$time)." seconds)");
?>
after 30 seconds, the HTTP 500 is returned to the client, but in the php
error_log the script continue its execution.

According to the documentation, TimeOut is set to 60 seconds by default, so it
should not be an issue, but in case, the following explicit definition were
tested without improvement:

1. ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/opt/httpd/htdocs/app/$1
timeout=300

2. in virtual host: ProxyTimeout 300

3 in server config: TimeOut 300

The only workaround found was to hardcode the timeout in the mod_proxy_fcgi.c:
--- ./modules/proxy/mod_proxy_fcgi.c.orig       2013-04-16 16:09:25.970332062
+0200
+++ ./modules/proxy/mod_proxy_fcgi.c    2013-04-16 16:09:56.311088966 +0200
@@ -575,7 +575,7 @@
         /* 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);
+            timeout = apr_time_from_sec(300);
         }

         rv = apr_poll(&pfd, 1, &n, timeout);

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

jkaluza@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30829|0                           |1
        is obsolete|                            |

--- Comment #5 from jkaluza@redhat.com ---
Created attachment 30833
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30833&action=edit
proposed patch v3

Even better patch. Now uses apr_socket_timeout_get.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

--- Comment #3 from jkaluza@redhat.com ---
Created attachment 30829
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30829&action=edit
proposed patch v2

Better patch respecting previous "conn->worker->s->timeout" timeout if set.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

--- Comment #4 from jkaluza@redhat.com ---
The fact that you were not able to set "timeout=300" is caused by PR 43513.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

apacheorg@rupostel.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apacheorg@rupostel.com
            Version|2.4.4                       |2.4.6
           Severity|normal                      |critical

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

Jeff Trawick <tr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jeff Trawick <tr...@apache.org> ---
Fixed in 2.4.8:

 *) mod_proxy_fcgi: Use apr_socket_timeout_get instead of hard-coded
     30 seconds timeout. [Jan Kaluza]

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

--- Comment #1 from apacheorg@rupostel.com ---
we confirm this behavior with: 
mod_proxy_fcgi
mod_proxy
apache event mpm 
on latest stable apache 2.4.6 

we are using: 

(we tried both inside and outside virtualhost: )
<Proxy fcgi://socket=%2fdev%2fshm%2ffpm-php.sock>
        ProxySet timeout=3600
        ProxySet connectiontimeout=3600
</Proxy>

ProxyPassMatch ^/(.*\.php(/.*)?)$
fcgi://socket=%2fdev%2fshm%2ffpm-php.sock/mobilnet.sk/$1 timeout=3600
connectiontimeout=3600

OR
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^/?(.*\.php)$ fcgi://socket=\%2fdev\%2fshm\%2ffpm-php.sock/path/$1
[P,L]

but none of them accepts the timeout: 
[proxy_fcgi:error] (70007)The timeout specified has expired: [...] AH01075:
Error dispatching request to:

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

jkaluza@redhat.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30828|0                           |1
        is obsolete|                            |

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

--- Comment #2 from jkaluza@redhat.com ---
Created attachment 30828
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30828&action=edit
proposed patch

This patch removes hardcoded 30 second timeout from mod_proxy_fcgi and replaces
it with ProxyTimeout/Timeout.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54973] mod_proxy_fcgi does not honnor Timeout / ProxyTimeout

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54973

Rich Williams <ri...@fabsuite.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rich@fabsuite.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org