From: Christopher Faulet Date: Mon, 3 Feb 2025 07:28:43 +0000 (+0100) Subject: DEBUG: http-ana: Remove debug counters from HTTP analyzers X-Git-Tag: v3.2-dev5~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c6512f8fca824719c32312bbfa28312f01164fe;p=thirdparty%2Fhaproxy.git DEBUG: http-ana: Remove debug counters from HTTP analyzers Several debug counters were added in HTTP analyzers to help debugging a strange issue about early aborts. But these counters are a bit overkill now. Especially because it is now possible to rely on the termination event log. So just remove them. Note that these counters are still there in 3.1. --- diff --git a/src/http_ana.c b/src/http_ana.c index 75a8523fb..33cfbb0ce 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1015,10 +1015,8 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) * response. Otherwise, let a change to forward the response * first. */ - if (txn->rsp.msg_state >= HTTP_MSG_BODY && htx_is_empty(htxbuf(&s->res.buf))) { - COUNT_IF(1, "Server abort during request forwarding"); + if (txn->rsp.msg_state >= HTTP_MSG_BODY && htx_is_empty(htxbuf(&s->res.buf))) goto return_srv_abort; - } } http_end_request(s); @@ -1050,10 +1048,8 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) missing_data_or_waiting: /* stop waiting for data if the input is closed before the end */ - if (msg->msg_state < HTTP_MSG_ENDING && (s->scf->flags & (SC_FL_ABRT_DONE|SC_FL_EOS))) { - COUNT_IF(1, "Client abort during request forwarding"); + if (msg->msg_state < HTTP_MSG_ENDING && (s->scf->flags & (SC_FL_ABRT_DONE|SC_FL_EOS))) goto return_cli_abort; - } waiting: /* waiting for the last bits to leave the buffer */ @@ -1061,10 +1057,8 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) /* Handle server aborts only if there is no response. Otherwise, * let a change to forward the response first. */ - if (htx_is_empty(htxbuf(&s->res.buf))) { - COUNT_IF(1, "Server abort during request forwarding"); + if (htx_is_empty(htxbuf(&s->res.buf))) goto return_srv_abort; - } } /* When TE: chunked is used, we need to get there again to parse remaining @@ -1128,7 +1122,6 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) _HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors); stream_report_term_evt(s->scf, strm_tevt_type_internal_err); status = 500; - COUNT_IF(1, "Internal error during request forwarding"); goto return_prx_cond; return_bad_req: @@ -1137,7 +1130,6 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) _HA_ATOMIC_INC(&sess->listener->counters->failed_req); stream_report_term_evt(s->scf, strm_tevt_type_proto_err); status = 400; - COUNT_IF(1, "Request parsing error during request forwarding"); /* fall through */ return_prx_cond: @@ -2182,7 +2174,6 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit if ((s->scf->flags & SC_FL_SHUT_DONE) && co_data(res)) { /* response errors are most likely due to the client aborting * the transfer. */ - COUNT_IF(1, "Client abort during response forwarding"); goto return_cli_abort; } @@ -2196,10 +2187,8 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit return 0; missing_data_or_waiting: - if (s->scf->flags & SC_FL_SHUT_DONE) { - COUNT_IF(1, "Client abort during response forwarding"); + if (s->scf->flags & SC_FL_SHUT_DONE) goto return_cli_abort; - } /* stop waiting for data if the input is closed before the end. If the * client side was already closed, it means that the client has aborted, @@ -2208,15 +2197,11 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit */ if (msg->msg_state < HTTP_MSG_ENDING && (s->scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE))) { if ((s->scf->flags & SC_FL_ABRT_DONE) && - (s->scb->flags & SC_FL_SHUT_DONE)) { - COUNT_IF(1, "Client abort during response forwarding"); + (s->scb->flags & SC_FL_SHUT_DONE)) goto return_cli_abort; - } /* If we have some pending data, we continue the processing */ - if (htx_is_empty(htx)) { - COUNT_IF(1, "Server abort during response forwarding"); + if (htx_is_empty(htx)) goto return_srv_abort; - } } /* When TE: chunked is used, we need to get there again to parse @@ -2276,7 +2261,6 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit _HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors); if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_INTERNAL; - COUNT_IF(1, "Internal error during response forwarding"); stream_report_term_evt(s->scb, strm_tevt_type_internal_err); goto return_error; @@ -2287,7 +2271,6 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP); } stream_inc_http_fail_ctr(s); - COUNT_IF(1, "Response parsing error during response forwarding"); stream_report_term_evt(s->scb, strm_tevt_type_proto_err); /* fall through */