Opened 7 years ago

Closed 7 years ago

#1277 closed defect (wontfix)

u-> in ngx_http_upstream_finalize_request

Reported by:… Owned by:
Priority: minor Milestone:
Component: other Version: 1.11.x
Keywords: Cc:
uname -a:
nginx -V: 1.11.6


upstream backend-test {

server; return 502
return 502
server; return 502


server {

listen 8000;
proxy_next_upstream error timeout http_502;
proxy_pass http://backend-test;


when curl,

ngx_http_upstream_free_round_robin_peer will enter three times,
first return 502, state NGX_PEER_FAILED
second return 502, state NGX_PEER_FAILED
but thrid return 502, state is zero,because of ngx_http_upstream_finalize_request:

if (u-> && u->peer.sockaddr) {

u->>peer, u->, 0); state always is zero
u->peer.sockaddr = NULL;


Change History (1)

comment:1 by Maxim Dounin, 7 years ago

Resolution: wontfix
Status: newclosed

The NGX_PEER_FAILED flag is only set when switching to the next upstream server as per the proxy_next_upstream directive. As nginx has no other servers to try in the third case, nginx simply returns a response it got from the last server, and doesn't try to mark it as failed.

Note: See TracTickets for help on using tickets.