]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: fd: maintain a per-thread update mask
authorWilly Tarreau <w@1wt.eu>
Sat, 20 Jan 2018 22:53:50 +0000 (23:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 23 Jan 2018 14:41:19 +0000 (15:41 +0100)
commitebc78d78a27ac3de7308eeb499c51d638e79ed6b
tree979660368ac529fbe8a00a64b2f651749908ddfb
parent32467fef98f9a4f14be8864bc44b3551f8e34759
BUG/MEDIUM: fd: maintain a per-thread update mask

Since the fd update tables are per-thread, we need to have a bit per
thread to indicate whether an update exists, otherwise this can lead
to lost update events every time multiple threads want to update the
same FD. In practice *for now*, it only happens at start time when
listeners are enabled and ask for polling after facing their first
EAGAIN. But since the pollers are still shared, a lost event is still
recovered by a neighbor thread. This will not reliably work anymore
with per-thread pollers, where it has been observed a few times on
startup that a single-threaded listener would not always accept
incoming connections upon startup.

It's worth noting that during this code review it appeared that the
"new" flag in the fdtab isn't used anymore.

This fix should be backported to 1.8.
include/proto/fd.h
include/types/fd.h
src/cli.c
src/ev_epoll.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/fd.c
src/stream.c