This patch is a part of series to reintroduce the program support in the new
master-worker architecture.
For the moment we keep the order of program and worker forks the same as before
the refactoring, as we need to be sure that this won't introduce regressions.
So, programs are forked before the new worker process.
Before the program's fork we already need deserialized processes list to find
the programs launched before reload and to stop them. Processes list saved
before the reload in HAPROXY_PROCESSES variable. It should be deserialized
before the first configuration read in discovery mode, because resetenv keyword
could be presented in the global section.
So, let's move mworker_env_to_proc_list() from mworker_create_master_cli() to
main(). We need to call it only after reload in master-worker mode, thus
HAPROXY_MWORKER_REEXEC and HAPROXY_PROCESSES should be still presented in the
re-executing process environment before the first configuration read.
*/
step_init_1();
+ /* deserialize processes list, if we do reload in master-worker mode */
+ if ((getenv("HAPROXY_MWORKER_REEXEC") != NULL)) {
+ if (mworker_env_to_proc_list() < 0) {
+ ha_alert("Master failed to deserialize monitored processes list, "
+ "it's a non-recoverable error, exiting.\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
/* parse conf in disovery mode and set modes from config */
read_cfg_in_discovery_mode(argc, argv);
{
struct wordlist *it, *c;
- /* get the info of the children in the env */
- if (mworker_env_to_proc_list() < 0) {
- exit(EXIT_FAILURE);
- }
-
if (!LIST_ISEMPTY(&mworker_cli_conf)) {
char *path = NULL;