From: Willy Tarreau Date: Wed, 29 Dec 2010 13:32:28 +0000 (+0100) Subject: [BUG] session: release slot before processing pending connections X-Git-Tag: v1.5-dev8~339 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b89cfca49428e79af1514c782cf0654cda3938ba;p=thirdparty%2Fhaproxy.git [BUG] session: release slot before processing pending connections 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. --- diff --git a/src/session.c b/src/session.c index 0f5db314a8..120f670f7a 100644 --- a/src/session.c +++ b/src/session.c @@ -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);