[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.
This commit is contained in:
Willy Tarreau 2008-03-28 18:09:38 +01:00
parent ebaf21af95
commit f899b94e63

View File

@ -2568,12 +2568,15 @@ int process_srv(struct session *t)
((t->req->l == 0 && !(req->flags & BF_WRITE_STATUS)) || ((t->req->l == 0 && !(req->flags & BF_WRITE_STATUS)) ||
t->be->options & PR_O_ABRT_CLOSE))) { /* give up */ t->be->options & PR_O_ABRT_CLOSE))) { /* give up */
tv_eternity(&req->cex); tv_eternity(&req->cex);
if (!(t->flags & SN_CONN_TAR)) {
/* if we are in turn-around, we have already closed the FD */
fd_delete(t->srv_fd); fd_delete(t->srv_fd);
if (t->srv) { if (t->srv) {
t->srv->cur_sess--; t->srv->cur_sess--;
if (t->srv->proxy->lbprm.server_drop_conn) if (t->srv->proxy->lbprm.server_drop_conn)
t->srv->proxy->lbprm.server_drop_conn(t->srv); t->srv->proxy->lbprm.server_drop_conn(t->srv);
} }
}
/* note that this must not return any error because it would be able to /* note that this must not return any error because it would be able to
* overwrite the client_retnclose() output. * overwrite the client_retnclose() output.