From 7a267c4a276e3648b2e4bf107587b6f3e00de77d Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Thu, 10 Oct 2024 23:51:20 +0200 Subject: [PATCH] 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. --- src/mworker.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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"); } } -- 2.47.3