From: Olivier Houchard Date: Fri, 17 May 2019 13:40:49 +0000 (+0200) Subject: BUG/MEDIUM: streams: Try to L7 retry before aborting the connection. X-Git-Tag: v2.0-dev4~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6db1699f7743c7c3aa202aacd6cc24bb32e9b2f2;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: streams: Try to L7 retry before aborting the connection. In htx_wait_for_response, in case of error, attempt a L7 retry before aborting the connection if the TX_NOT_FIRST flag is set. If we don't do that, then we wouldn't attempt L7 retries after the first request, or if we use HTTP/2, as with HTTP/2 that flag is always set. --- diff --git a/src/proto_htx.c b/src/proto_htx.c index e7341c1ae1..6393eed6a2 100644 --- a/src/proto_htx.c +++ b/src/proto_htx.c @@ -1496,9 +1496,6 @@ int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit) if (rep->flags & CF_READ_ERROR) { struct connection *conn = NULL; - if (txn->flags & TX_NOT_FIRST) - goto abort_keep_alive; - if (objt_cs(s->si[1].end)) conn = objt_cs(s->si[1].end)->conn; @@ -1514,6 +1511,9 @@ int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit) return 0; } + if (txn->flags & TX_NOT_FIRST) + goto abort_keep_alive; + _HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1); if (objt_server(s->target)) { _HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1); @@ -1591,15 +1591,15 @@ int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit) /* 4: close from server, capture the response if the server has started to respond */ else if (rep->flags & CF_SHUTR) { - if (txn->flags & TX_NOT_FIRST) - goto abort_keep_alive; - if ((si_b->flags & SI_FL_L7_RETRY) && (s->be->retry_type & PR_RE_DISCONNECTED)) { if (co_data(rep) || do_l7_retry(s, si_b) == 0) return 0; } + if (txn->flags & TX_NOT_FIRST) + goto abort_keep_alive; + _HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1); if (objt_server(s->target)) { _HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);