From: Christopher Faulet Date: Tue, 14 Nov 2023 06:47:52 +0000 (+0100) Subject: BUG/MEDIUM: stream: Properly handle abortonclose when set on backend only X-Git-Tag: v2.9-dev10~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ff7d2276;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stream: Properly handle abortonclose when set on backend only Since the 2.2 and the commit dedd30610 ("MEDIUM: h1: Don't wake the H1 tasklet if we got the whole request."), we avoid to subscribe for reads if the H1 message is fully received. However, this broke the abortonclose option. To fix the issue, a CO_RFL flag was added to instruct the mux it should still wait for read events to properly handle read0. Only the H1 mux was concerned. But since then, most of time, the option is only handled if it is set on the frontend proxy because the request is fully received before selecting the backend. If the backend is selected before the end of the request there is no issue. But otherwise, because the backend is not known yet, we are unable to properly handle the option and we miss to subscribe for reads. Of course the option cannot be set on a frontend proxy. So concretly it means the option is properly handled if it is enabled in the defaults section (if common to frontend and backend) or a listen proxy, but it is ignored if it is set on backend only. Thanks to previous patches, we can now instruct the mux it should subscribe for reads if not already done. We use this mechanism in process_stream() when the connection is set up, ie when backend SC is set to SC_ST_REQ state. This patch relies on following patches: * MINOR: connection: Add a CTL flag to notify mux it should wait for reads again * MEDIUM: mux-h1: Handle MUX_SUBS_RECV flag in h1_ctl() and susbscribe for reads This patch should be the issue #2344. All the series must be backported as far as 2.2. --- diff --git a/src/stream.c b/src/stream.c index 6a6166eea7..14060b2e9d 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2292,6 +2292,13 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) (s->be->mode == PR_MODE_HTTP) && !(s->txn->flags & TX_D_L7_RETRY)) s->txn->flags |= TX_L7_RETRY; + + if (s->be->options & PR_O_ABRT_CLOSE) { + struct connection *conn = sc_conn(scf); + + if (conn) + conn->mux->ctl(conn, MUX_SUBS_RECV, NULL); + } } } else {