summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2021-11-24 13:11:50 +0300
committerMax Romanov <max.romanov@nginx.com>2021-11-24 13:11:50 +0300
commitaaa34e0a644912e49d7c5619749b67f585da9c85 (patch)
treee9a13205f13cab6c02163cbcca16586568d894ae /src/nxt_main_process.c
parentc33c2925d91510e1c059a1581aad6dd959817191 (diff)
downloadunit-aaa34e0a644912e49d7c5619749b67f585da9c85.tar.gz
unit-aaa34e0a644912e49d7c5619749b67f585da9c85.tar.bz2
Fixing zombie process appearance and hang up on shutdown.
After the c8790d2a89bb commit, the SIGCHLD handler may return before processing all awaiting PIDs. To avoid zombie processes and ensure successful main process termination, waitpid() must be called until an error is returned. This closes #600 issue on GitHub.
Diffstat (limited to '')
-rw-r--r--src/nxt_main_process.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index a5a20d3d..61521854 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -950,9 +950,11 @@ nxt_main_process_sigchld_handler(nxt_task_t *task, void *obj, void *data)
if (rt->nprocesses <= 1) {
nxt_runtime_quit(task, 0);
+
+ return;
}
- return;
+ continue;
}
nxt_port_remove_notify_others(task, process);