1
Index: haproxy/include/proto/queue.h
2
===================================================================
3
--- haproxy.orig/include/proto/queue.h 2008-12-30 18:27:39.000000000 +0100
4
+++ haproxy/include/proto/queue.h 2008-12-30 18:29:16.000000000 +0100
8
/* returns 0 if nothing has to be done for server <s> regarding queued connections,
9
- * and non-zero otherwise. Suited for and if/else usage.
10
+ * and non-zero otherwise. If the server is down, we only check its own queue. Suited for and if/else usage.
12
static inline int may_dequeue_tasks(const struct server *s, const struct proxy *p) {
13
- return (s && (s->nbpend || p->nbpend) &&
14
+ return (s && (s->nbpend || (p->nbpend && (s->state & SRV_RUNNING))) &&
15
(!s->maxconn || s->cur_sess < srv_dynamic_maxconn(s)));
18
Index: haproxy/src/queue.c
19
===================================================================
20
--- haproxy.orig/src/queue.c 2008-12-30 18:29:24.000000000 +0100
21
+++ haproxy/src/queue.c 2008-12-30 18:30:33.000000000 +0100
23
* returned. Note that neither <srv> nor <px> may be NULL.
24
* Priority is given to the oldest request in the queue if both <srv> and <px>
25
* have pending requests. This ensures that no request will be left unserved.
26
+ * The <px> queue is not considered if the server is not RUNNING. The <srv>
27
+ * queue is still considered in this case, because if some connections remain
28
+ * there, it means that some requests have been forced there after it was seen
29
+ * down (eg: due to option persist).
30
* The session is immediately marked as "assigned", and both its <srv> and
31
* <srv_conn> are set to <srv>,
34
ps = pendconn_from_srv(srv);
35
pp = pendconn_from_px(px);
36
/* we want to get the definitive pendconn in <ps> */
38
+ if (!pp || !(srv->state & SRV_RUNNING)) {
42
Index: haproxy/src/session.c
43
===================================================================
44
--- haproxy.orig/src/session.c 2008-12-30 18:30:52.000000000 +0100
45
+++ haproxy/src/session.c 2008-12-30 18:35:40.000000000 +0100
49
pendconn_free(s->pend_pos);
50
- if (s->srv) /* there may be requests left pending in queue */
51
- process_srv_queue(s->srv);
52
+ if (s->srv) { /* there may be requests left pending in queue */
53
+ if (may_dequeue_tasks(s->srv, s->be))
54
+ process_srv_queue(s->srv);
56
if (unlikely(s->srv_conn)) {
57
/* the session still has a reserved slot on a server, but
58
* it should normally be only the same as the one above,