From: Willy Tarreau Date: Fri, 6 Aug 2010 08:08:23 +0000 (+0200) Subject: [BUG] queue: don't dequeue proxy-global requests on disabled servers X-Git-Tag: v1.5-dev8~489 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d132f746f27cfdf8438f74a56c435fc920406392;p=thirdparty%2Fhaproxy.git [BUG] queue: don't dequeue proxy-global requests on disabled servers If a server is disabled or tracking a disabled server, it must not dequeue requests pending in the proxy queue, it must only dequeue its own ones. The problem that was caused is that if a backend always had requests in its queue, a disabled server would continue to take traffic forever. (was commit 09d02aaf02d1f21c0c02672888f3a36a14bdd299 in 1.4) --- diff --git a/src/queue.c b/src/queue.c index 5be6cdfe9c..38b15429d7 100644 --- a/src/queue.c +++ b/src/queue.c @@ -86,7 +86,8 @@ void process_srv_queue(struct server *s) * returned. Note that neither nor may be NULL. * Priority is given to the oldest request in the queue if both and * have pending requests. This ensures that no request will be left unserved. - * The queue is not considered if the server is not RUNNING. The + * The queue is not considered if the server (or a tracked server) is not + * RUNNING, is disabled, or has a null weight (server going down). The * queue is still considered in this case, because if some connections remain * there, it means that some requests have been forced there after it was seen * down (eg: due to option persist). @@ -97,11 +98,16 @@ struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px) { struct pendconn *ps, *pp; struct session *sess; + struct server *rsrv; + + rsrv = srv->tracked; + if (!rsrv) + rsrv = srv; ps = pendconn_from_srv(srv); pp = pendconn_from_px(px); /* we want to get the definitive pendconn in */ - if (!pp || !(srv->state & SRV_RUNNING)) { + if (!pp || !(rsrv->state & SRV_RUNNING) || (rsrv->state & (SRV_GOINGDOWN|SRV_MAINTAIN))) { if (!ps) return NULL; } else {