]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: signals/poller: ensure wakeup from signals
authorMatthias Wirth <matthias.wirth@gmail.com>
Fri, 9 Sep 2022 08:21:00 +0000 (10:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Sep 2022 09:15:22 +0000 (11:15 +0200)
commiteea152ee68e82eae49ae188cd1b1fbbf63dc6913
tree42740714191892071ecf183c82bb90327ecc95c4
parentef2d2340e62d7ad3207c4cdb2c9d8e31f7615f03
BUG/MINOR: signals/poller: ensure wakeup from signals

Add self-wake in signal_handler() to fix a race condition with a signal
coming in between checking signal_queue_len and entering polling sleep.

The changes in commit 43c891dda ("BUG/MINOR: signals/poller: set the
poller timeout to 0 when there are signals") were insufficient.

Move the signal_queue_len check from the poll implementations to
run_poll_loop() to keep that logic in one place.

The poll loops are terminated either by the parameter wake being set or
wake up due to a write to their poller_wr_pipe by wake_thread() in
signal_handler().

This fixes issue #1841.

Must be backported in every stable version.
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c
src/haproxy.c
src/signal.c