[Kimchi-devel] [PATCH v2] Increasing nginx proxy timeout

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Aug 7 21:25:11 UTC 2014


Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>

On 08/06/2014 03:28 PM, Daniel Henrique Barboza wrote:
> The 60 seconds nginx timeout is creating some issues with actions
> that takes some time to complete, like creating a VM with a NFS
> template. After 60 seconds without a backend answer, the user is
> presented with a 504 Gateway Timeout error.
>
> This patch increases the timeout to 600 seconds, 10 minutes. This is
> enough time to process all the backend requests and ensure that a
> 504 error will only occur in a legitimate error in the backend.
>
> The Timeout Monitor of cherrypy is also being disabled, since we're
> using the nginx timeout and the session timeout instead.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
> ---
>   src/kimchi/server.py | 5 +++++
>   src/nginx.conf.in    | 7 +++++++
>   2 files changed, 12 insertions(+)
>
> diff --git a/src/kimchi/server.py b/src/kimchi/server.py
> index 0db0bb3..bca2147 100644
> --- a/src/kimchi/server.py
> +++ b/src/kimchi/server.py
> @@ -74,6 +74,11 @@ class Server(object):
>                   os.makedirs(directory)
>
>           self.configObj = KimchiConfig()
> +        # We'll use the session timeout (= 10 minutes) and the
> +        # nginx timeout (= 10 minutes). This monitor isn't involved
> +        # in anything other than monitor the timeout of the connection,
> +        # thus it is safe to unsubscribe.
> +        cherrypy.engine.timeout_monitor.unsubscribe()
>           cherrypy.tools.nocache = cherrypy.Tool('on_end_resource', set_no_cache)
>           cherrypy.tools.kimchiauth = cherrypy.Tool('before_handler',
>                                                     auth.kimchiauth)
> diff --git a/src/nginx.conf.in b/src/nginx.conf.in
> index 3a8dfc5..1d1a398 100644
> --- a/src/nginx.conf.in
> +++ b/src/nginx.conf.in
> @@ -38,6 +38,13 @@ http {
>       access_log  /var/log/nginx/access.log  main;
>       sendfile    on;
>
> +    # Timeout set to 10 minutes to avoid the 504 Gateway Timeout
> +    # when Kimchi is processing a request.
> +    proxy_connect_timeout       600;
> +    proxy_send_timeout          600;
> +    proxy_read_timeout          600;
> +    send_timeout                600;
> +
>       server {
>           listen $proxy_ssl_port ssl;
>




More information about the Kimchi-devel mailing list