]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Don't perform zero-copy FF if opposite SC is blocked
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Nov 2023 16:56:30 +0000 (17:56 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Nov 2023 13:01:56 +0000 (14:01 +0100)
When zero-copy data fast-forwarding is inuse, if the opposite SC is blocked,
there is no reason to try to fast-forward more data. Worst, in some cases,
this can lead to a receive loop of the producer side while the consumer side
is blocked.

No backport needed.

include/haproxy/sc_strm.h

index c54b6162cbc4f3f49d4e0c7d609213edec75fc80..722662eaa48b170103f262866109d9a7c4c6726b 100644 (file)
@@ -281,6 +281,9 @@ static inline int sc_is_recv_allowed(const struct stconn *sc)
        if (sc_ep_test(sc, SE_FL_HAVE_NO_DATA))
                return 0;
 
+       if (sc_ep_test(sc, SE_FL_MAY_FASTFWD) && (sc_opposite(sc)->sedesc->iobuf.flags & IOBUF_FL_FF_BLOCKED))
+               return 0;
+
        return !(sc->flags & (SC_FL_WONT_READ|SC_FL_NEED_BUFF|SC_FL_NEED_ROOM));
 }