From: Christopher Faulet Date: Tue, 16 Apr 2019 11:55:08 +0000 (+0200) Subject: BUG/MEDIUM: mux-h1: Notify the stream waiting for TCP splicing if ibuf is empty X-Git-Tag: v2.0-dev3~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7d5ff37e07483be5d6eca84379c83d1a8edadfa;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mux-h1: Notify the stream waiting for TCP splicing if ibuf is empty When a stream-interface want to use the TCP splicing to forward its data, it notifies the mux h1. We will then flush the input buffer and don't read more data. So the stream-interface will not be notified for read anymore, except if an error or a read0 is detected. It is a problem everytime the receive I/O callback is called again. It happens when the pipe is full or when no data are received on the pipe. It also happens when the input buffer is freshly flushed. Because the TCP splicing is enabled, nothing is done in h1_recv() and the stream-interface is never woken up. So, now, in h1_recv(), if the TCP splicing is used and the input buffer is empty, the stream-interface is notified for read. This patch must be backported to 1.9. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 32da39980e..b5e47c680d 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1723,13 +1723,15 @@ static int h1_recv(struct h1c *h1c) goto end; } - if (h1s && (h1s->flags & (H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA))) { - rcvd = 1; + if (!h1_get_buf(h1c, &h1c->ibuf)) { + h1c->flags |= H1C_F_IN_ALLOC; goto end; } - if (!h1_get_buf(h1c, &h1c->ibuf)) { - h1c->flags |= H1C_F_IN_ALLOC; + if (h1s && (h1s->flags & (H1S_F_BUF_FLUSH|H1S_F_SPLICED_DATA))) { + if (!b_data(&h1c->ibuf)) + h1_wake_stream_for_recv(h1s); + rcvd = 1; goto end; }