Hi, folks,<div><br></div><div>We have found a bug with the keepalive module. When we used the keepalive module, the directive proxy_next_upstream seems disabled. </div><div><br></div><div>We use Nginx as reverse server. Our backend servers simply close connection when read some abnormal packets. Nginx will call the function ngx_http_upstream_next() and try to use the next server. The ft_type is NGX_HTTP_UPSTREAM_FT_ERROR. We want to turn off the try mechanism with such packets. Otherwise, it will try all the servers every time. We use directive proxy_next_upstream off. If it's not keepalive connection, everything is fine. If it's keepalive connection, it will run such code:</div>
<div><br></div><div><div>2858 if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) {</div><div>2859 status = 0;</div><div>2860</div><div>2861 /* TODO: inform balancer instead */</div>
<div>2862</div><div>2863 u->peer.tries++;</div><div>2864</div></div><div><br></div><div>The status is cleared to be 0. The below code will never be touched:</div><div><br></div><div><div>2896 if (status) {</div>
<div>2897 u->state->status = status;</div><div>2898</div><div>2899 if (u->peer.tries == 0 || !(u->conf->next_upstream & ft_type)) {</div></div><div><br></div><div><div>The variable of tries and u->conf->next_upstream become useless.</div>
<div><br></div><div>I don't know why the cached connection should clear the status, Can we just remove the code from line 2858 to 2864? Is there any side effect?</div><div><br></div>-- <br>Weibin Yao<br>Developer @ Server Platform Team of Taobao
</div>