From b89cfca49428e79af1514c782cf0654cda3938ba Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 29 Dec 2010 14:32:28 +0100 Subject: [PATCH] [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. --- src/session.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/session.c b/src/session.c index 0f5db314a..120f670f7 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);