From: Valentine Krasnobaeva Date: Thu, 10 Oct 2024 21:50:39 +0000 (+0200) Subject: MINOR: mworker-prog: stop old programs in mworker_ext_launch_all X-Git-Tag: v3.1-dev10~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e23cfa5c29d880f9cdbef0d795565cb44726935;p=thirdparty%2Fhaproxy.git MINOR: mworker-prog: stop old programs in mworker_ext_launch_all This patch is a part of series to reintroduce the program support in the new master-worker architecture. Now, after refactoring in master-worker mode it's the master process, who stops workers forked before the reload. Current worker no longer sends USR1 or TERM signals to the previous one after ports binding. This behaviour is kept only for the standalone mode. So, in case of programs, it's up to master process as well to stop programs, which were launched before reload. Let's do this in mworker_ext_launch_all(), just before starting the new programs. --- diff --git a/src/mworker-prog.c b/src/mworker-prog.c index 59c0fee1d9..8f745c7c1e 100644 --- a/src/mworker-prog.c +++ b/src/mworker-prog.c @@ -49,6 +49,10 @@ int mworker_ext_launch_all() /* find the right mworker_proc */ list_for_each_entry_safe(child, tmp, &proc_list, list) { + /* need to stop progs, which were launched before reload */ + if ((child->options & PROC_O_TYPE_PROG) && (child->options & PROC_O_LEAVING)) + kill(child->pid, oldpids_sig); + if (child->reloads == 0 && (child->options & PROC_O_TYPE_PROG)) { if (reexec && (!(child->options & PROC_O_START_RELOAD))) {