From: Willy Tarreau Date: Sun, 27 Mar 2011 17:16:56 +0000 (+0200) Subject: [BUG] session: conn_retries was not always initialized X-Git-Tag: v1.5-dev8~258 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b3a4115431e47845f9a6dd1f75e000f88f75be7;p=thirdparty%2Fhaproxy.git [BUG] session: conn_retries was not always initialized Johannes Smith reported some wrong retries count in logs associated with bad requests. The cause was that the conn_retries field in the stream interface was only initialized when attempting to connect, but is used when logging, possibly with an uninitialized value holding last connection's conn_retries. This could have been avoided by making use of a stream interface initializer. This bug is 1.5-specific. --- diff --git a/src/proto_http.c b/src/proto_http.c index 30177eeeef..ef6f46ea84 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -3987,6 +3987,7 @@ void http_end_txn_clean_session(struct session *s) s->req->cons->state = s->req->cons->prev_state = SI_ST_INI; s->req->cons->fd = -1; /* just to help with debugging */ s->req->cons->err_type = SI_ET_NONE; + s->req->cons->conn_retries = 0; /* used for logging too */ s->req->cons->err_loc = NULL; s->req->cons->exp = TICK_ETERNITY; s->req->cons->flags = SI_FL_NONE; diff --git a/src/session.c b/src/session.c index 24df9365e0..d673aaa63c 100644 --- a/src/session.c +++ b/src/session.c @@ -188,6 +188,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->si[1].owner = t; s->si[1].state = s->si[1].prev_state = SI_ST_INI; s->si[1].err_type = SI_ET_NONE; + s->si[1].conn_retries = 0; /* used for logging too */ s->si[1].err_loc = NULL; s->si[1].connect = NULL; s->si[1].release = NULL;