From: Willy Tarreau Date: Thu, 15 Nov 2018 15:06:02 +0000 (+0100) Subject: BUG/MINOR: stream-int: make sure not to go through the rcv_buf path after splice() X-Git-Tag: v1.9-dev7~121 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffb1205a4710fcec54e5ce86141660f5888ea3b1;p=thirdparty%2Fhaproxy.git BUG/MINOR: stream-int: make sure not to go through the rcv_buf path after splice() 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. --- diff --git a/src/stream_interface.c b/src/stream_interface.c index 8b0ce146bc..da8d2b1779 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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)) {