From 27b00629e1e3af2f8b84aa349351df50f05f3c83 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 14 Feb 2018 16:33:35 +0300 Subject: Fixed race condition while discovering modules. Previously, the discovery process might exit before the main process received a list of available modules. --- src/nxt_main_process.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nxt_main_process.c') diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index 80af51a5..f0b55c1b 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -1112,6 +1112,7 @@ nxt_main_port_modules_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) nxt_mp_t *mp; nxt_int_t ret; nxt_buf_t *b; + nxt_port_t *port; nxt_runtime_t *rt; nxt_conf_value_t *conf, *root, *value; nxt_app_lang_module_t *lang; @@ -1124,6 +1125,14 @@ nxt_main_port_modules_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) return; } + port = nxt_runtime_port_find(task->thread->runtime, msg->port_msg.pid, + msg->port_msg.reply_port); + + if (nxt_fast_path(port != NULL)) { + (void) nxt_port_socket_write(task, port, NXT_PORT_MSG_RPC_ERROR, -1, + msg->port_msg.stream, 0, NULL); + } + b = msg->buf; if (b == NULL) { -- cgit