]> git.kaiwu.me - haproxy.git/commit
[BUG] fix truncated responses with sepoll
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jan 2008 16:20:13 +0000 (17:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 20 Jan 2008 23:40:01 +0000 (00:40 +0100)
commit1ddaaa4228d9b2372660a45be8a7b7ea1e67e6a4
tree8a9f0540987f9fc9d2a4992f56999919e6dd06a6
parentbfd99b8173df5ded6c6f5a484396fa20997e25c9
[BUG] fix truncated responses with sepoll

Due to the way Linux delivers EPOLLIN and EPOLLHUP, a closed connection
received after some server data sometimes results in truncated responses
if the client disconnects before server starts to respond. The reason
is that the EPOLLHUP flag is processed as an indication of end of
transfer while some data may remain in the system's socket buffers.

This problem could only be triggered with sepoll, although nothing should
prevent it from happening with normal epoll. In fact, the work factoring
performed by sepoll increases the risk that this bug appears.

The fix consists in making FD_POLL_HUP and FD_POLL_ERR sticky and that
they are only checked if FD_POLL_IN is not set, meaning that we have
read all pending data.

That way, the problem is definitely fixed and sepoll still remains about
17% faster than epoll since it can take into account all information
returned by the kernel.
include/proto/fd.h
include/types/fd.h
src/checks.c
src/client.c
src/ev_sepoll.c
src/proto_uxst.c
src/stream_sock.c