]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Check FF data of SC to perform a shutdown in sc_notify()
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Oct 2024 09:54:54 +0000 (11:54 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Oct 2024 11:53:40 +0000 (13:53 +0200)
In sc_notify() function, the consumer side of the SC is tested to verify if
we must perform a shutdown on the endpoint. To do so, no output data must be
present in the buffer and in the iobuf. However, there is a bug here, the
iobuf of the opposite SC is tested instead of the one of the current SC. So
a shutdown can be performed on the endpoint while there are still output
data in the iobuf that must be sent. Concretely, it can only be data blocked
in a pipe.

Because of this bug, data blocked in the pipe will be never sent. I've not
tested but I guess this may block the stream during the client or server
timeout.

This patch must be backported as far as 2.9.

src/stconn.c

index ab5fe66dddb0b356a4fcc1dd5aa467073850cc81..ca067d6d0aa8a6933002d2590a83e675c508a1f2 100644 (file)
@@ -1119,7 +1119,7 @@ void sc_notify(struct stconn *sc)
        struct task *task = sc_strm_task(sc);
 
        /* process consumer side */
-       if (!co_data(oc) && !sc_ep_have_ff_data(sco)) {
+       if (!co_data(oc) && !sc_ep_have_ff_data(sc)) {
                struct connection *conn = sc_conn(sc);
 
                if (((sc->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) == SC_FL_SHUT_WANTED) &&