]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: threads: Use the sync point to check active jobs and exit
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 Jun 2018 14:22:03 +0000 (16:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Jun 2018 08:16:26 +0000 (10:16 +0200)
commitd8fd2af8826c2d33b23c4ef64b88ecd57910e330
tree68d979b82841a74a83820e57f97ff73f59521e02
parent8618a6a5e22a5df2f004fc30fefcb680fcff5b8d
BUG/MEDIUM: threads: Use the sync point to check active jobs and exit

When HAProxy is shutting down, it exits the polling loop when there is no jobs
anymore (jobs == 0). When there is no thread, it works pretty well, but when
HAProxy is started with several threads, a thread can decide to exit because
jobs variable reached 0 while another one is processing a task (e.g. a
health-check). At this stage, the running thread could decide to request a
synchronization. But because at least one of them has already gone, the others
will wait infinitly in the sync point and the process will never die.

To fix the bug, when the first thread (and only this one) detects there is no
active jobs anymore, it requests a synchronization. And in the sync point, all
threads will check if jobs variable reached 0 to exit the polling loop.

This patch must be backported in 1.8.
src/haproxy.c