]> 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 22:56:15 +0000 (23:56 +0100)
commit4489d003d1e60a024641ff5dac1110ee0eb3f270
tree2fdac231e8b5fe2454906153e57bf62341c710ca
parentf5e62d371f7d34b9e726cd5c9944539af22a9215
[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_tcp.c
src/proto_uxst.c
src/stream_sock.c