]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: listener: make the accept function more robust against pauses
authorWilly Tarreau <w@1wt.eu>
Wed, 7 May 2014 17:47:02 +0000 (19:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 May 2014 21:13:08 +0000 (23:13 +0200)
commitbb66030a3050594c045537feb9bbab9e7c94c45e
tree0fa87d898aa14bb785003a79d38c871432f668cf
parent2a83111cee659ecc8c7956fc39097d33876b7a6e
MEDIUM: listener: make the accept function more robust against pauses

During some tests in multi-process mode under Linux, it appeared that
issuing "disable frontend foo" on the CLI to pause a listener would
make the shutdown(read) of certain processes disturb another process
listening on the same socket, resulting in a 100% CPU loop. What
happens is that accept() returns EAGAIN without accepting anything.
Fortunately, we see that epoll_wait() reports EPOLLIN+EPOLLRDHUP
(likely because the FD points to the same file in the kernel), so we
can use that to stop the other process from trying to accept connections
for a short time and try again later, hoping for the situation to change.
We must not disable the FD otherwise there's no way to re-enable it.

Additionally, during these tests, a loop was encountered on EINVAL which
was not caught. Now if we catch an EINVAL, we proceed the same way, in
case the socket is re-enabled later.
src/listener.c