]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stconn: Pretend the SE have more data to deliver on abortonclose
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Oct 2024 06:26:20 +0000 (08:26 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Oct 2024 09:16:24 +0000 (11:16 +0200)
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.

src/stconn.c
src/stream.c

index ca067d6d0aa8a6933002d2590a83e675c508a1f2..94ea9758ad0d3971136d1007d1164bceceda832d 100644 (file)
@@ -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
index f0cb8cf8016aca0eb82603047751269b6a8c4de5..9ad26b4ce6202611ab1d767ba78f818aacbe7b5c 100644 (file)
@@ -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);
                                }