max_fails includes read_timeout even if timeout is excluded from proxy_next_upstream

tomp nginx-forum at nginx.us
Thu Sep 22 11:34:02 UTC 2011


Hi,

I am having some trouble with the latest stable of Nginx's proxy
upstream support.

I would like Nginx to NOT count read timeouts towards the max_fails in
the upstream definition.

Here is what I have:

proxy_cache_path        /var/cache/nginx/tptest levels=1:2  
keys_zone=tptest:10m;

upstream tptestBackend
{
        server tp.dev.infinity.local max_fails=1 fail_timeout=30s;
        server dn.dev.infinity.local max_fails=1 fail_timeout=30s;
}

server
{
        listen                  172.16.0.64:80;
        server_name             tp.nginx.dev.infinity.local;

        proxy_cache             tptest;
        proxy_set_header        Host 'tp.dev.infinity.local';
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_cache_key         http://$host$request_uri;
        proxy_connect_timeout   1;
        proxy_cache_use_stale   error timeout updating invalid_header
http_500 http_502 http_503 http_504;
        proxy_next_upstream     error http_500 http_502 http_503
http_504;
        proxy_read_timeout      5;

        location /
        {
                proxy_pass      http://tptestBackend;
        }
}

I have removed "timeout" from the proxy_next_upstream directive, however
when I try with a script that sleeps forever, the timeout kicks in, but
it does count towards the max_fails, and so next time only the second
server is used.

Is this a bug?

Thanks

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,215585,215585#msg-215585



More information about the nginx mailing list