From: Christopher Faulet Date: Tue, 22 Oct 2024 06:26:20 +0000 (+0200) Subject: BUG/MINOR: stconn: Pretend the SE have more data to deliver on abortonclose X-Git-Tag: v3.1-dev11~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dc930d231d7576ea73c36a86085ab74f174e8c5;p=thirdparty%2Fhaproxy.git BUG/MINOR: stconn: Pretend the SE have more data to deliver on abortonclose When abortonclose option is enabled on the backend, at the SC level, we must still pretend the SE have more data to deliver to be able to receive the EOS. It must be performed at 2 places: * When the backend is set and the connection is requested. It is when the option is seen for the first time. * After a receive attempt, if the EOI flag is set on the sedesc. Otherwise, when an abort is detected by the mux, the SC is not notified. This patch should fix the issue #2764. This bug probably exists in all stable version but is only visible since bca5e1423 ("OPTIM: stconn: Don't pretend mux have more data to deliver on EOI/EOS/ERROR"). So I suggest to not backport it for now, except if the commit above is backported. --- diff --git a/src/stconn.c b/src/stconn.c index ca067d6d0a..94ea9758ad 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1546,8 +1546,11 @@ int sc_conn_recv(struct stconn *sc) se_have_no_more_data(sc->sedesc); } else if (sc->flags & SC_FL_EOI) { - /* No more data are expected at this stage */ - se_have_no_more_data(sc->sedesc); + /* No more data are expected at this stage, except if abortonclose is enabled */ + if (!(flags & CO_RFL_KEEP_RECV)) + se_have_no_more_data(sc->sedesc); + else + se_have_more_data(sc->sedesc); } else { /* The mux may have more data to deliver. Be sure to be able to diff --git a/src/stream.c b/src/stream.c index f0cb8cf801..9ad26b4ce6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2316,6 +2316,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) if (s->be->options & PR_O_ABRT_CLOSE) { struct connection *conn = sc_conn(scf); + se_have_more_data(scf->sedesc); if (conn && conn->mux && conn->mux->ctl) conn->mux->ctl(conn, MUX_CTL_SUBS_RECV, NULL); }