summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-09-20 17:30:56 +0300
committerMax Romanov <max.romanov@nginx.com>2018-09-20 17:30:56 +0300
commit58c38298f53e684e2b5a45e5f7cf053f142ba384 (patch)
tree2c38f21650ae96393f3999fd46f6459e1867a29c
parentd0e428aace21c7b3462afacde6955fb1017596db (diff)
downloadunit-58c38298f53e684e2b5a45e5f7cf053f142ba384.tar.gz
unit-58c38298f53e684e2b5a45e5f7cf053f142ba384.tar.bz2
Resetting init->stream for ready process.
Router requests application start by sending port message with application parameters to master. In response router gets application port. Stream id used to link request and response. If application process terminates unexpectedly (e.g. before ready state), it is required to notify router about application start failure. For this purpose stream id is stored in process initialization parameters. Stream id sequentially incremented and starts from 1 in case of router resurrection. New router application start stream id may coincide with stream id of currently running/terminating application processes. In such cases router may receive REMOVE_PID message with same stream id as used in application start request and mistakenly reports application start failure. This commit tries to avoid such errors by resetting stream for processes in ready state.
-rw-r--r--src/nxt_main_process.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 37e09911..491b09f3 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -907,6 +907,10 @@ nxt_main_cleanup_worker_process(nxt_task_t *task, nxt_pid_t pid)
ptype = nxt_process_type(process);
+ if (process->ready && init != NULL) {
+ init->stream = 0;
+ }
+
nxt_process_close_ports(task, process);
if (!nxt_exiting) {