]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: raw_sock: must check error code on hangup
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Dec 2012 23:01:33 +0000 (00:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Dec 2012 23:01:33 +0000 (00:01 +0100)
commitdebdc4b657056e517287f03f8439bb8e49be43ba
tree5d06465fa7e4024bfea340d0966e7a39762faccb
parentee2663b1cd59a82d2f2eeb4cca6a943e43ea645e
BUG/MAJOR: raw_sock: must check error code on hangup

In raw_sock, we already check for FD_POLL_HUP after a short recv()
to avoid a useless syscall and detect the end of stream. However,
we fail to check for FD_POLL_ERR here, which causes major issues
as some errors might be delivered and ignored if they are delivered
at the same time as a HUP, and there is no data to send to detect
them on the other direction.

Since the connections flags do not have the CO_FL_ERROR flag, the
polling is not disabled on the socket and the pollers immediately
call the conn_fd_handler() again, resulting in CPU spikes for as
long as the timeouts allow them.

Note that this patch alone fixes the issue but a few patches will
follow to strengthen this fragile area.

Big thanks to Bryan Berry who reported the issue with significant
amounts of detailed traces that helped rule out many other initially
suspected causes and to finally reproduce the issue in the lab.
src/raw_sock.c