mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
BUG/MEDIUM: splicing is broken since 1.5-dev12
Commit 96199b10
reintroduced the splice() mechanism in the new connection
system. However, it failed to account for the number of transferred bytes,
allowing more bytes than scheduled to be transferred to the client. This
can cause an issue with small-chunked responses, where each packet from
the server may contain several chunks, because a single splice() call may
succeed, then try to splice() a second time as the pipe is not full, thus
consuming the next chunk size.
This patch also reverts commit baf2a5 ("OPTIM: splice: detect shutdowns...")
because it introduced a related regression. The issue is that splice() may
return less data than available also if the pipe is full, so having EPOLLRDHUP
after splice() returns less than expected is not a sufficient indication that
the input is empty.
In both cases, the issue may be detected by the presence of "SD" termination
flags in the logs, and worked around by disabling splicing (using "-dS").
This problem was reported by Sander Klein, and no backport is needed.
This commit is contained in:
parent
91418063c3
commit
4fc90efed0
@ -159,10 +159,7 @@ int raw_sock_to_pipe(struct connection *conn, struct pipe *pipe, unsigned int co
|
||||
|
||||
retval += ret;
|
||||
pipe->data += ret;
|
||||
|
||||
/* if a POLL_HUP was present, we've read the last segment */
|
||||
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_ERR|FD_POLL_HUP)) == FD_POLL_HUP)
|
||||
goto out_read0;
|
||||
count -= ret;
|
||||
|
||||
if (pipe->data >= SPLICE_FULL_HINT || ret >= global.tune.recv_enough) {
|
||||
/* We've read enough of it for this time, let's stop before
|
||||
|
Loading…
Reference in New Issue
Block a user