diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-04-10 16:21:58 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-04-10 16:21:58 +0300 |
commit | 58cc13ab291cac5b13462006e3feb780178ef5f3 (patch) | |
tree | 0c52174f577f308b097922a1f5c8f14f86169355 /src/nxt_router.c | |
parent | c7f5c1c6641838006088524c2122eae8f9c30431 (diff) | |
download | unit-58cc13ab291cac5b13462006e3feb780178ef5f3.tar.gz unit-58cc13ab291cac5b13462006e3feb780178ef5f3.tar.bz2 |
Resolving a racing condition while adding ports on the app's side.
An earlier attempt (ad6265786871) to resolve this condition on the
router's side added a new issue: the app could get a request before
acquiring a port.
Diffstat (limited to 'src/nxt_router.c')
-rw-r--r-- | src/nxt_router.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index a70b03d1..2f4ea698 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -4811,7 +4811,7 @@ nxt_router_app_prepare_request(nxt_task_t *task, apr_action = NXT_APR_REQUEST_FAILED; - c_port = nxt_process_connected_port_find_add(port->process, reply_port); + c_port = nxt_process_connected_port_find(port->process, reply_port); if (nxt_slow_path(c_port != reply_port)) { res = nxt_port_send_port(task, port, reply_port, 0); @@ -4820,10 +4820,10 @@ nxt_router_app_prepare_request(nxt_task_t *task, nxt_request_app_link_error(task, port->app, req_app_link, "Failed to send reply port to application"); - nxt_process_connected_port_remove(port->process, reply_port); - goto release_port; } + + nxt_process_connected_port_add(port->process, reply_port); } buf = nxt_router_prepare_msg(task, req_app_link->request, port, |