]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: readapt program support in mworker_catch_sigchld
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 10 Oct 2024 21:51:20 +0000 (23:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
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

index 59f799d1eaba80c66981ef0908f3a6aa49f1bf68..31374eafc1d069083b37f3147ee708d33b8d79e5 100644 (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");
                                }
                        }