ngx_http_upstream_test_next u->peer.tries > 1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ngx_http_upstream_test_next u->peer.tries > 1

ashuai
assume all servers always fail in upstream

nginx would call ngx_http_upstream_next when u->peer.tries > 1, and call
ngx_http_upstream_finalize_request directly when  u->peer.tries == 1

it would not pass NGX_PEER_FAILED to u->peer.free

so how peer->fails increase when last retry fail?

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

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: ngx_http_upstream_test_next u->peer.tries > 1

Maxim Dounin
Hello!

On Fri, Nov 24, 2017 at 03:23:30AM -0500, crasyangel wrote:

> assume all servers always fail in upstream
>
> nginx would call ngx_http_upstream_next when u->peer.tries > 1, and call
> ngx_http_upstream_finalize_request directly when  u->peer.tries == 1
>
> it would not pass NGX_PEER_FAILED to u->peer.free
>
> so how peer->fails increase when last retry fail?

The result of the last attempt is returned to the client as is,
and it is not considered to be a failure regardless of other
settings.  In the edge case when there is only one server,
requests are simply passed to the server.

If there is more than one server, and all servers fail, the first
request will disable all servers but the last one (assuming
default max_fails=1), and the second request will disable the last
server.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx