]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Wait iobuf is empty to shut SE down during a check send
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 10 Oct 2024 08:34:23 +0000 (10:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Oct 2024 11:53:40 +0000 (13:53 +0200)
When a send attempt is performed on the opposite side from sc_notify() and
all outgoing data are sent while a shut was scheduled, the SE is shut down
because we consider all data were sent and no more are expected. However,
here we must also be carefull to have sent all pending data in the
iobuf. Indeed, some spliced data may be blocked. In this case, if the SE is
shut down, these data may be lost.

This patch should fix the original bug reported in #2749. It must be
backported as far as 2.9.

src/stconn.c

index bf9f7b0aa51e1a0dd697beabe216c3cbf244035d..ab5fe66dddb0b356a4fcc1dd5aa467073850cc81 100644 (file)
@@ -873,7 +873,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
        /* OK, so now we know that some data might have been sent, and that we may
         * have to poll first. We have to do that too if the buffer is not empty.
         */
-       if (!co_data(oc)) {
+       if (!co_data(oc) && !sc_ep_have_ff_data(sc)) {
                /* the connection is established but we can't write. Either the
                 * buffer is empty, or we just refrain from sending because the
                 * ->o limit was reached. Maybe we just wrote the last