mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-22 05:36:56 +00:00
BUG/MEDIUM: stream-int: clear CO_FL_WAIT_ROOM after splicing data in
Since we don't necessarily pass through conn_fd_handler() when reading, conn_refresh_polling_flags() is not necessarily called when performing a recv() operation, thus flags like CO_FL_WAIT_ROOM are not cleared. It happens that si_cs_recv() checks CO_FL_WAIT_ROOM before deciding to receive into a buffer, to see if the previous rcv_pipe() call failed by lack of pipe room. The combined effect of these two statements is that at the end of a file transmission, when there's too little data to warrant the use of a pipe and the pipe is empty, we refrain from using rcv_pipe() for the last few bytes, but since CO_FL_WAIT_ROOM is still present, we don't use rcv_buf() either, and the connection remains frozen in this state with si_cs_recv() called in loops. In order to fix this we can simply manually clear CO_FL_WAIT_ROOM when not using pipe so that the next check sees the result of the previous operation and not an old one. We could equally call cond_refresh_polling_flags() but that would be overkill and dangerous given that it would manipulate the connection's flags under the mux. By the way ideally the mux should report this flag into the connstream for cleaner manipulation. No backport is needed as this is only post 1.9-dev2.
This commit is contained in:
parent
f6975aa920
commit
81464b4e4d
@ -1200,6 +1200,10 @@ int si_cs_recv(struct conn_stream *cs)
|
||||
|
||||
/* splice not possible (anymore), let's go on on standard copy */
|
||||
}
|
||||
else {
|
||||
/* be sure not to block regular receive path below */
|
||||
conn->flags &= ~CO_FL_WAIT_ROOM;
|
||||
}
|
||||
|
||||
abort_splice:
|
||||
if (ic->pipe && unlikely(!ic->pipe->data)) {
|
||||
|
Loading…
Reference in New Issue
Block a user