summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-02-14 16:33:35 +0300
committerValentin Bartenev <vbart@nginx.com>2018-02-14 16:33:35 +0300
commit27b00629e1e3af2f8b84aa349351df50f05f3c83 (patch)
treeac658830c5ba40a71ce6a5afb4b46dbe7b1fdb3b /src/nxt_main_process.c
parent94049bf30f9feccefe805f56b3a75339c25ee39d (diff)
downloadunit-27b00629e1e3af2f8b84aa349351df50f05f3c83.tar.gz
unit-27b00629e1e3af2f8b84aa349351df50f05f3c83.tar.bz2
Fixed race condition while discovering modules.
Previously, the discovery process might exit before the main process received a list of available modules.
Diffstat (limited to 'src/nxt_main_process.c')
-rw-r--r--src/nxt_main_process.c9
1 files changed, 9 insertions, 0 deletions
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) {