]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream-int: make sure not to go through the rcv_buf path after splice()
authorWilly Tarreau <w@1wt.eu>
Thu, 15 Nov 2018 15:06:02 +0000 (16:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 15 Nov 2018 16:00:08 +0000 (17:00 +0100)
When splice() reports a pipe full condition, we go through the common
code used to release a possibly empty pipe (which we don't have) and which
immediately tries to allocate a buffer that will never be used. Further,
it may even subscribe to get this buffer if the resources are low. Let's
simply get out of this way if the pipe is full.

This fix could be backported to 1.8 though the code is a bit different
overthere.

src/stream_interface.c

index 8b0ce146bc83937f9570d07ccad84e3edfc311c3..da8d2b1779be91ce9e40549f8d4a010287f81976 100644 (file)
@@ -1196,6 +1196,7 @@ int si_cs_recv(struct conn_stream *cs)
                         * could soon be full. Let's stop before needing to poll.
                         */
                        si_cant_put(si);
+                       goto done_recv;
                }
 
                /* splice not possible (anymore), let's go on on standard copy */
@@ -1290,6 +1291,7 @@ int si_cs_recv(struct conn_stream *cs)
                        break;
        } /* while !flags */
 
+ done_recv:
        if (cur_read) {
                if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) &&
                    (cur_read <= ic->buf.size / 2)) {