summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2021-01-25 13:13:17 +0300
committerMax Romanov <max.romanov@nginx.com>2021-01-25 13:13:17 +0300
commit9b76505bf7fe7954ebd66e23fc29dab2e6b02e47 (patch)
tree3daad4fb29c37088deffaefb9889e94fc05504c2 /src/nxt_router.c
parent6e28263d6531c9461a3a1d49a98bf8d33898c599 (diff)
downloadunit-9b76505bf7fe7954ebd66e23fc29dab2e6b02e47.tar.gz
unit-9b76505bf7fe7954ebd66e23fc29dab2e6b02e47.tar.bz2
Router: fixing assertion in shortage of file descriptors.
Each application in router process required fd for a request queue shared memory. When the number of file descripts close to the limit, and port sockets successfully opened, router needs to properly handle the errors. This patch closes port sockets before destroying port structure to avoid file descriptors leakage and assertion in debug build.
Diffstat (limited to 'src/nxt_router.c')
-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 0416dea0..8d6e493d 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1586,6 +1586,8 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
ret = nxt_router_app_queue_init(task, port);
if (nxt_slow_path(ret != NXT_OK)) {
+ nxt_port_write_close(port);
+ nxt_port_read_close(port);
nxt_port_use(task, port, -1);
return NXT_ERROR;
}