Skip to content

Commit cd57ee7

Browse files
einval22wlallemand
authored andcommitted
BUG/MINOR: mworker: mworker_reexec: unset MODE_STARTING before free startup logs ring
Flag MODE_STARTING should be unset for master just before freeing the startup logs ring, as it triggers the copy of process logs to this ring, see the code of print_message(). Moreover with this flag set, if startup logs ring pointer is NULL, any print_message() triggered just before the execvp in mworker_reexec() will call startup_logs_init(). So ring will be allocated again "discretely" and after execvp we will lost its address, as in step_init_1() we will call again startup_logs_init(). No need to backport this fix as it's related to the latest master-worker refactoring.
1 parent 984d2cf commit cd57ee7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/haproxy.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,6 @@ static void mworker_reexec(int hardreload)
749749

750750
mworker_proc_list_to_env(); /* put the children description in the env */
751751

752-
startup_logs_free(startup_logs);
753-
754752
/* during the reload we must ensure that every FDs that can't be
755753
* reuse (ie those that are not referenced in the proc_list)
756754
* are closed or they will leak. */
@@ -832,6 +830,12 @@ static void mworker_reexec(int hardreload)
832830
for (i = 1; i < old_argc; i++)
833831
next_argv[next_argc++] = old_argv[i];
834832

833+
/* need to withdraw MODE_STARTING from master, because we have to free
834+
* the startup logs ring here, see more details in print_message()
835+
*/
836+
global.mode &= ~MODE_STARTING;
837+
startup_logs_free(startup_logs);
838+
835839
signal(SIGPROF, SIG_IGN);
836840
execvp(next_argv[0], next_argv);
837841
ha_warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno));

0 commit comments

Comments
 (0)