BUG/MEDIUM: pollers: clear the sleeping bit after waking up, not before
authorWilly Tarreau <w@1wt.eu>
Fri, 30 Jul 2021 08:57:09 +0000 (10:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 30 Jul 2021 08:57:09 +0000 (10:57 +0200)
commitc37ccd70b4f622a4148cb63d3b584357b02cda47
tree5dacb9dcc2f78e6cfb7c379c03c43f9e125230dc
parent6ed242ece6b5bc5c99a10350ded1bdd6321dde8b
BUG/MEDIUM: pollers: clear the sleeping bit after waking up, not before

A bug was introduced in 2.1-dev2 by commit 305d5ab46 ("MAJOR: fd: Get
rid of the fd cache."). Pollers "poll" and "evport" had the sleeping
bit accidentally removed before the syscall instead of after. This
results in them not being woken up by inter-thread wakeups, which is
particularly visible with the multi-queue accept() and with queues.

As a work-around, when these pollers are used, "nbthread 1" should
be used.

The fact that it has remained broken for 2 years is a great indication
that threads are definitely not enabled outside of epoll and kqueue,
hence why this patch is only tagged medium.

This must be backported as far as 2.2.
src/ev_evports.c
src/ev_poll.c