CLEANUP: mworker: clean mworker_reexec

Before refactoring master-worker architecture, resources to setup master CLI
for the new worker process (shared sockpair, entry in proc_list) were created
in init() before parsing the configuration and binding listening sockets. So,
master during its re-exec has had to cleanup the new worker's ressources in
a case, when it fails at some initialization step before the fork.

Now fork happens very early and worker parses its configuration by itself. If
it fails during the initialization stage, all clean ups (deleting the fds of
the shared sockpair, proc_list cleanup) are performed in SIGCHLD handler up to
catching the SIGCHLD corresponded to this new worker. So, there is no longer
need to call mworker_cleanup_proc() in mworker_reexec().

As for mworker_cleanlisteners(), there is no longer need to call this function.
Master parses now only "global" and "program" sections, so it allocates only
MASTER proxy, which is stopped in mworker_reexec() by mworker_cli_proxy_stop().

Let's keep the definitions of mworker_cleanlisteners() and
mworker_cleanup_proc() in mworker.c for the moment. We may reuse parts of its
code later.
This commit is contained in:
Valentine Krasnobaeva 2024-10-23 15:46:54 +02:00 committed by William Lallemand
parent 4db0f69527
commit a0d727e069
1 changed files with 0 additions and 4 deletions

View File

@ -747,12 +747,8 @@ static void mworker_reexec(int hardreload)
setenv("HAPROXY_MWORKER_REEXEC", "1", 1); setenv("HAPROXY_MWORKER_REEXEC", "1", 1);
mworker_cleanup_proc();
mworker_proc_list_to_env(); /* put the children description in the env */ mworker_proc_list_to_env(); /* put the children description in the env */
/* ensure that we close correctly every listeners before reexecuting */
mworker_cleanlisteners();
startup_logs_free(startup_logs); startup_logs_free(startup_logs);
/* during the reload we must ensure that every FDs that can't be /* during the reload we must ensure that every FDs that can't be