]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mworker: cleanup the listeners when reexecuting
authorWilliam Lallemand <wlallemand@haproxy.org>
Thu, 18 Nov 2021 09:51:30 +0000 (10:51 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 18 Nov 2021 10:01:16 +0000 (11:01 +0100)
Previously, the cleanup of the listeners was done in mworker_loop(),
which was called once the configuration file was parsed. HAProxy was
switching in wait mode when the configuration failed to load, so no
listeners where created.

Since the latest change on the mworker mode, HAProxy switch to wait mode
after successfuly loading the configuration, without cleaning its
listeners, because it was done in mworker_loop, resulting in the master
not closing its listeners and keeping them. The master needs its
configuration to know which listeners it need to close, so that must be
done before the exec().

This patch fixes the problem by cleaning the listeners in the
mworker_reexec() function.

No backport needeed.

src/haproxy.c

index 187ba750ae9ba1c621b7564f10e42938fd4751bb..3c04c58e6eece035ef42c5320b196cb9351e2dc1 100644 (file)
@@ -709,6 +709,9 @@ static void mworker_reexec()
 
        mworker_proc_list_to_env(); /* put the children description in the env */
 
+       /* ensure that we close correctly every listeners before reexecuting */
+       mworker_cleanlisteners();
+
        /* during the reload we must ensure that every FDs that can't be
         * reuse (ie those that are not referenced in the proc_list)
         * are closed or they will leak. */
@@ -838,7 +841,6 @@ static void mworker_loop()
        signal_register_fct(SIGCHLD, mworker_catch_sigchld, SIGCHLD);
 
        mworker_unblock_signals();
-       mworker_cleanlisteners();
        mworker_cleantasks();
 
        mworker_catch_sigchld(NULL); /* ensure we clean the children in case