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.
This commit is contained in:
Valentine Krasnobaeva 2024-10-10 23:51:20 +02:00 committed by Willy Tarreau
parent d766677d92
commit 7a267c4a27

View File

@ -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");
}
}