summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/nxt_main_process.c9
-rw-r--r--src/nxt_port.c2
2 files changed, 8 insertions, 3 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;
}
}
diff --git a/src/nxt_port.c b/src/nxt_port.c
index cef65cab..9029353a 100644
--- a/src/nxt_port.c
+++ b/src/nxt_port.c
@@ -546,7 +546,7 @@ nxt_port_use(nxt_task_t *task, nxt_port_t *port, int i)
if (i < 0 && c == -i) {
- if (task->thread->engine == port->engine) {
+ if (port->engine == NULL || task->thread->engine == port->engine) {
nxt_port_release(task, port);
return;