-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
We fond a problem when use balance by lua module. The process is like bellow:
- Client visit a right url and ngx setup a keep alive connection to upstream peer success;
- Another client visit a wrong url and ngx send the request to the the upstream peer;
- The upstream peer find the request is a wrong url and close the connection immediately;
- Then, ngx while try setup new connections and sent the wrong request repeatitively until we reload ngx.
I find you reduse u->peer.tries in ngx_http_lua_balancer_free_peer
but ngx_http_upstream_next do u->peer.tries++. That makes me confused.
ngx_http_upstream_next:
if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR
&& (!u->request_sent || !r->request_body_no_buffering))
{
status = 0;
/* TODO: inform balancer instead */
u->peer.tries++;
} else {
ngx_http_lua_balancer_free_peer:
if (bp->sockaddr && bp->socklen) {
bp->last_peer_state = (int) state;
if (pc->tries) {
pc->tries--;
}
return;
}
Metadata
Metadata
Assignees
Labels
No labels