summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2021-05-25 18:01:00 +0300
committerMax Romanov <max.romanov@nginx.com>2021-05-25 18:01:00 +0300
commit24905c1a00dbf8f62c902d1b248279c5a31cf199 (patch)
tree395cca0429c208f97801753fff07334c00f23de6
parent155e22da05f01eb51b9dc082e9c8e8bff9b5ec8d (diff)
downloadunit-24905c1a00dbf8f62c902d1b248279c5a31cf199.tar.gz
unit-24905c1a00dbf8f62c902d1b248279c5a31cf199.tar.bz2
Fixing racing condition on listen socket close in router (v2).
This patch fixes a possible race between the nxt_router_conf_wait() and nxt_router_listen_socket_release() function calls and improves the 7f1b2eaa2d58 commit fix.
Diffstat (limited to '')
-rw-r--r--src/nxt_router.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 2bbe87b8..c597863e 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -3285,17 +3285,17 @@ nxt_router_listen_socket_close(nxt_task_t *task, void *obj, void *data)
joint = lev->socket.data;
lev->socket.data = NULL;
+ /* 'task' refers to lev->task and we cannot use after nxt_free() */
+ task = &task->thread->engine->task;
+
+ nxt_router_listen_socket_release(task, joint->socket_conf);
+
job = joint->close_job;
job->work.next = NULL;
job->work.handler = nxt_router_conf_wait;
nxt_event_engine_post(job->tmcf->engine, &job->work);
- /* 'task' refers to lev->task and we cannot use after nxt_free() */
- task = &task->thread->engine->task;
-
- nxt_router_listen_socket_release(task, joint->socket_conf);
-
nxt_router_listen_event_release(task, lev, joint);
}