From: Christopher Faulet Date: Tue, 7 Jul 2020 09:57:12 +0000 (+0200) Subject: BUG/MEDIUM: connection: Continue to recv data to a pipe when the FD is not ready X-Git-Tag: v2.1.8~39 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=0c9e47f79c9f40d913d79239be599c4bd7234543;p=haproxy-2.1.git BUG/MEDIUM: connection: Continue to recv data to a pipe when the FD is not ready Don't wait a FD is ready to receive data to try to get data to a pipe to be sure to not be blocked. Indeed, after a call to raw_sock_to_pipe(), the readiness for a FD may be disabled because we read enough data (fd_done_recv) or because nothing was received (fd_cant_recv). In the first case, the readiness is not re-enabled after a successful send on the opposite side. On the 2.2, calls to fd_done_recvt() was removed from raw_sock functions in the commit 1113116b4 ("MEDIUM: raw-sock: remove obsolete calls to fd_{cant,cond,done}_{send,recv}"). But it is a bit dangerous to directely backport it in a stable version because many changes were perforned on the connection layer in the 2.2. So to unblock the situation, it is safer to just remove the test on the FD at the beginning of raw_sock_to_pipe(). At worst, we have an extra syscall from time to time. This patch must be backported to 2.0. --- diff --git a/src/raw_sock.c b/src/raw_sock.c index 6ef9fab..3377939 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -69,9 +69,6 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe, if (!conn_ctrl_ready(conn)) return 0; - if (!fd_recv_ready(conn->handle.fd)) - return 0; - conn->flags &= ~CO_FL_WAIT_ROOM; conn_refresh_polling_flags(conn); errno = 0;