Re: haproxy news in -git, and snapshots

From: Willy Tarreau <w#1wt.eu>
Date: Thu, 3 Apr 2008 06:18:13 +0200


Hi Krzysztof,

On Thu, Apr 03, 2008 at 01:09:07AM +0200, Krzysztof Oledzki wrote:
> Are there any chances that with this patch (commit
> 541b5c24ca070789f2474a6c8f2398dc3877aeb5) in some, not yet clear to me
> situation, it is possible to get a server with a negative connection
> count? It happened serveral times and I connect it somehow with this patch
> as AFAIK there were no other changes in this area.
>
> I have never observed such situation without this patch, but as I have not
> been able to debug it to much, so maybe my shot is wrong. I'll try to get
> some more information but maybe you have an idea?.

Yes, and we had to debug it at a customer's. It may happen when the client reports an error and immediately switches to CL_STCLOSE while the server is in turn-around state. The patch has been merged last week in master (here it is).

Regards,
Willy

From a4b7e7f28a4771fcd6b14d90308bd164cc82f5fd Mon Sep 17 00:00:00 2001 From: Willy Tarreau <w#1wt.eu>
Date: Fri, 28 Mar 2008 18:09:38 +0100
Subject: [BUG] fix double-decrement of server connections

If a client does a sudden dirty close (CL_STCLOSE) during a server connect turn-around, then the number of server connections is decremented twice. This causes huge problems on the affected server because when its connection number becomes negative, it overflows and prevents the server from accepting new connections due to an apparent saturation.

The fix consists in not decrementing the counter if the server is in a turn-around state.

---
 src/proto_http.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/proto_http.c b/src/proto_http.c
index 82acc48..a46fe24 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2470,11 +2470,14 @@ int process_srv(struct session *t)
 		     ((t->req->l == 0 && !(req->flags & BF_WRITE_STATUS)) ||
 		      t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
 			tv_eternity(&req->cex);
-			fd_delete(t->srv_fd);
-			if (t->srv) {
-				t->srv->cur_sess--;
-				if (t->srv->proxy->lbprm.server_drop_conn)
-					t->srv->proxy->lbprm.server_drop_conn(t->srv);
+			if (!(t->flags & SN_CONN_TAR)) {
+				/* if we are in turn-around, we have already closed the FD */
+				fd_delete(t->srv_fd);
+				if (t->srv) {
+					t->srv->cur_sess--;
+					if (t->srv->proxy->lbprm.server_drop_conn)
+						t->srv->proxy->lbprm.server_drop_conn(t->srv);
+				}
 			}
 
 			/* note that this must not return any error because it would be able to
-- 
1.5.3.8
Received on 2008/04/03 06:18

This archive was generated by hypermail 2.2.0 : 2008/04/03 06:30 CEST