From: Valentine Krasnobaeva Date: Thu, 10 Oct 2024 21:51:20 +0000 (+0200) Subject: MINOR: mworker: readapt program support in mworker_catch_sigchld X-Git-Tag: v3.1-dev10~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a267c4a276e3648b2e4bf107587b6f3e00de77d;p=thirdparty%2Fhaproxy.git MINOR: mworker: readapt program support in mworker_catch_sigchld This patch is a part of series to reintroduce the program support in the new master-worker architecture. We just only launch and stop external programs and there is no any communication between the master process and the started program binary. So, ipc_fd[0] and ipc_fd[1] are not used and kept as -1 for programs processes. Due to this, no need for the exiting program process to call fd_delete on this fds. Otherwise, this will trigger a BUG_ON. --- diff --git a/src/mworker.c b/src/mworker.c index 59f799d1ea..31374eafc1 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -416,11 +416,15 @@ restart_wait: if (exitcode < 0 && status != 0 && status != 143) exitcode = status; } else { - fd_delete(child->ipc_fd[0]); if (child->options & PROC_O_TYPE_WORKER) { ha_warning("Former worker (%d) exited with code %d (%s)\n", exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit"); + /* Delete fd from poller fdtab, which will close it */ + fd_delete(child->ipc_fd[0]); delete_oldpid(exitpid); } else if (child->options & PROC_O_TYPE_PROG) { + /* ipc_fd[0] and ipc_fd[1] are not used for PROC_O_TYPE_PROG and kept as -1, + * thus they are never inserted in fdtab (otherwise, BUG_ON in fd_insert if fd <0) + */ ha_warning("Former program '%s' (%d) exited with code %d (%s)\n", child->id, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit"); } }