summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Lallemand <wlallemand@haproxy.org>2021-11-26 14:43:57 +0100
committerWilliam Lallemand <wlallemand@haproxy.org>2021-11-26 14:43:57 +0100
commitefd954793e60131932c61883d0869c7912a5d12c (patch)
treef0aca4acab6e2b06538f21a5a35e263b6c1509a5
parentd450ff636c00da113e6069648e63824245deaad9 (diff)
downloadhaproxy-efd954793e60131932c61883d0869c7912a5d12c.tar.gz
BUG/MINOR: mworker: deinit of thread poller was called when not initialized20211125-revert-fd-leak
Commit 67e371e ("BUG/MEDIUM: mworker: FD leak of the eventpoll in wait mode") introduced a regression. Upon a reload it tries to deinit the poller per thread, but no poll loop was initialized after loading the configuration. This patch fixes the issue by moving this part of the code in mworker_reload(), since this function will be called only when the poller is fully initialized. This patch must be backported in 2.5.
-rw-r--r--src/haproxy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/haproxy.c b/src/haproxy.c
index 094a8393a..dda03a994 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -661,7 +661,6 @@ static void mworker_reexec()
int i = 0;
char *msg = NULL;
struct rlimit limit;
- struct per_thread_deinit_fct *ptdf;
struct mworker_proc *current_child = NULL;
mworker_block_signals();
@@ -683,11 +682,9 @@ static void mworker_reexec()
/* close the listeners FD */
mworker_cli_proxy_stop();
- /* close the poller FD and the thread waker pipe FD */
- list_for_each_entry(ptdf, &per_thread_deinit_list, list)
- ptdf->fct();
if (fdtab)
deinit_pollers();
+
#ifdef HAVE_SSL_RAND_KEEP_RANDOM_DEVICES_OPEN
/* close random device FDs */
RAND_keep_random_devices_open(0);
@@ -773,9 +770,14 @@ static void mworker_reexec_waitmode()
void mworker_reload()
{
struct mworker_proc *child;
+ struct per_thread_deinit_fct *ptdf;
ha_notice("Reloading HAProxy\n");
+ /* close the poller FD and the thread waker pipe FD */
+ list_for_each_entry(ptdf, &per_thread_deinit_list, list)
+ ptdf->fct();
+
/* increment the number of reloads */
list_for_each_entry(child, &proc_list, list) {
child->reloads++;