diff options
author | Max Romanov <max.romanov@nginx.com> | 2019-09-18 22:45:30 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2019-09-18 22:45:30 +0300 |
commit | 1fac43eebe4136a2f57c56f23fc90a33783e63f2 (patch) | |
tree | c335f51b7c55a8d0db1eb12d1654fb5e997678a5 /src/nxt_main_process.c | |
parent | ab40ce3757e6f9d50c9c1a8aa4ea01cb5278eafa (diff) | |
download | unit-1fac43eebe4136a2f57c56f23fc90a33783e63f2.tar.gz unit-1fac43eebe4136a2f57c56f23fc90a33783e63f2.tar.bz2 |
Fixing master process crash after failed fork.
This closes #312 issue on GitHub.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_main_process.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index 40682eb9..83c6d188 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -690,15 +690,18 @@ nxt_main_create_worker_process(nxt_task_t *task, nxt_runtime_t *rt, pid = nxt_process_create(task, process); - nxt_port_use(task, port, -1); - switch (pid) { case -1: + nxt_port_close(task, port); + nxt_port_use(task, port, -1); + return NXT_ERROR; case 0: /* A worker process, return to the event engine work queue loop. */ + nxt_port_use(task, port, -1); + return NXT_AGAIN; default: @@ -707,6 +710,8 @@ nxt_main_create_worker_process(nxt_task_t *task, nxt_runtime_t *rt, nxt_port_read_close(port); nxt_port_write_enable(task, port); + nxt_port_use(task, port, -1); + return NXT_OK; } } |