]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] session: release slot before processing pending connections
authorWilly Tarreau <w@1wt.eu>
Wed, 29 Dec 2010 13:32:28 +0000 (14:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 29 Dec 2010 13:38:29 +0000 (14:38 +0100)
When a connection error is encountered on a server and the server's
connection pool is full, pending connections are not woken up because
the current connection is still accounted for on the server, so it
still appears full. This becomes visible on a server which has
"maxconn 1" because the pending connections will only be able to
expire in the queue.

Now we take care of releasing our current connection before trying to
offer it to another pending request, so that the server can accept a
next connection.

This patch should be backported to 1.4.

src/session.c

index 0f5db314a80cb2782c22eebdc40947ba95e7b60c..120f670f7ada88f1d72c85a9ff5f737af56f092c 100644 (file)
@@ -606,6 +606,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
                if (s->srv)
                        s->srv->counters.failed_conns++;
                s->be->counters.failed_conns++;
+               sess_change_server(s, NULL);
                if (may_dequeue_tasks(s->srv, s->be))
                        process_srv_queue(s->srv);
 
@@ -628,6 +629,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
         */
        if (s->srv && si->conn_retries == 0 &&
            s->be->options & PR_O_REDISP && !(s->flags & SN_FORCE_PRST)) {
+               sess_change_server(s, NULL);
                if (may_dequeue_tasks(s->srv, s->be))
                        process_srv_queue(s->srv);
 
@@ -740,6 +742,7 @@ void sess_update_stream_int(struct session *s, struct stream_interface *si)
                        s->be->counters.failed_conns++;
 
                        /* release other sessions waiting for this server */
+                       sess_change_server(s, NULL);
                        if (may_dequeue_tasks(s->srv, s->be))
                                process_srv_queue(s->srv);