summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-10-04 14:57:29 +0300
committerMax Romanov <max.romanov@nginx.com>2017-10-04 14:57:29 +0300
commit4ae76249edb97775be8a0c749ad9ee79e3e85393 (patch)
tree31a809a7c0cf442c83ff8b662d0574c7703609c1
parentfcd141936cacee24109c8b64fd06c14925aca4a6 (diff)
downloadunit-4ae76249edb97775be8a0c749ad9ee79e3e85393.tar.gz
unit-4ae76249edb97775be8a0c749ad9ee79e3e85393.tar.bz2
Fixing memory leak when handling remove pid message.
Worker threads ports need to receive 'remove pid' message to properly handle application process exit case and finish requests processed by particular application worker. Main process send 'remove pid' notification to service thread port only and this message must be 'proxied' to other running engines. Separate memory pool created for this message. For each engine structure required to post message to engine allocate from the pool using 'retain' allocation method. After successfull post structure will be freed using 'release' method. To completely destroy poll one more 'release' should be called to release initial reference count. I'm afraid this should be simplified using good old malloc() and free() calls.
-rw-r--r--src/nxt_router.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 285c19b6..f923d72c 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -515,6 +515,8 @@ nxt_router_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
}
nxt_queue_loop;
+ nxt_mp_release(mp, NULL);
+
msg->port_msg.type = _NXT_PORT_MSG_RPC_ERROR;
nxt_port_rpc_handler(task, msg);