From: Christopher Faulet Date: Tue, 1 Feb 2022 17:25:06 +0000 (+0100) Subject: BUG/MEDIUM: mux-h1: Don't wake h1s if mux is blocked on lack of output buffer X-Git-Tag: v2.5.4~7 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=683246630c08c0c949e466b87b85bd09e30fb930;p=haproxy-2.5.git BUG/MEDIUM: mux-h1: Don't wake h1s if mux is blocked on lack of output buffer After sending some data, we try to wake the H1 stream to resume data processing at the stream level, except if the output buffer is still full. However we must also be sure the mux is not blocked because of an allocation failure on this buffer. Otherwise, it may lead to a ping-pong loop between the stream and the mux to send more data with an unallocated output buffer. Note there is a mechanism to queue buffers allocations when a failure happens. However this mechanism is totally broken since the filters were introducted in HAProxy 1.7. And it is worse now with the multiplexers. So this patch fixes a possible loop needlessly consuming all the CPU. But buffer allocation failures must remain pretty rare. This patch must be backported as far as 2.0. (cherry picked from commit c17c31c822dc4a5f3270f6ae4f96afa50fb7390f) Signed-off-by: Christopher Faulet --- diff --git a/src/mux_h1.c b/src/mux_h1.c index f112bf4..e18b509 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2731,7 +2731,7 @@ static int h1_send(struct h1c *h1c) } end: - if (!(h1c->flags & H1C_F_OUT_FULL)) + if (!(h1c->flags & (H1C_F_OUT_FULL|H1C_F_OUT_ALLOC))) h1_wake_stream_for_send(h1c->h1s); /* We're done, no more to send */