]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] queue: don't dequeue proxy-global requests on disabled servers
authorWilly Tarreau <w@1wt.eu>
Fri, 6 Aug 2010 08:08:23 +0000 (10:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Aug 2010 19:39:07 +0000 (21:39 +0200)
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)

src/queue.c

index 5be6cdfe9cc7f84c0f42ad84e14ad878cf2dfed2..38b15429d7d96f62f8b177c8a56675660bb9444f 100644 (file)
@@ -86,7 +86,8 @@ void process_srv_queue(struct server *s)
  * returned. Note that neither <srv> nor <px> may be NULL.
  * Priority is given to the oldest request in the queue if both <srv> and <px>
  * have pending requests. This ensures that no request will be left unserved.
- * The <px> queue is not considered if the server is not RUNNING. The <srv>
+ * The <px> 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 <srv>
  * 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 <ps> */
-       if (!pp || !(srv->state & SRV_RUNNING)) {
+       if (!pp || !(rsrv->state & SRV_RUNNING) || (rsrv->state & (SRV_GOINGDOWN|SRV_MAINTAIN))) {
                if (!ps)
                        return NULL;
        } else {