diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-08-13 16:08:38 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-08-13 16:08:38 +0300 |
commit | b04b5ce430ef055a7552b9fc451ca23f7d5effb3 (patch) | |
tree | c2d79beb714b5ca5fc71f4ed862420869d9bb756 /src/nxt_router.c | |
parent | b9ed3384cb620618c2622e387d1770bb8c43ff13 (diff) | |
download | unit-b04b5ce430ef055a7552b9fc451ca23f7d5effb3.tar.gz unit-b04b5ce430ef055a7552b9fc451ca23f7d5effb3.tar.bz2 |
Fixing router assertion in result of application prefork error.
Buffer for application prefork request allocated from temp conf mem_pool.
If error response from main process received before buffer completion handler,
temp conf mem_pool destroyed and router may crash in completion handler.
Assertion "src/nxt_buf.c:208 assertion failed: data == b->parent" triggered
when NXT_DEBUG_ALLOC enabled in configure.
This patch disables completion handler and memory allocated for buffer
released with memory pool.
Diffstat (limited to 'src/nxt_router.c')
-rw-r--r-- | src/nxt_router.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index 1318eeb4..0e1de6fa 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -219,6 +219,8 @@ static void nxt_router_http_request_error(nxt_task_t *task, void *obj, static void nxt_router_http_request_done(nxt_task_t *task, void *obj, void *data); +static void nxt_router_dummy_buf_completion(nxt_task_t *task, void *obj, + void *data); static void nxt_router_app_prepare_request(nxt_task_t *task, nxt_request_rpc_data_t *req_rpc_data); static nxt_buf_t *nxt_router_prepare_msg(nxt_task_t *task, @@ -2218,6 +2220,8 @@ nxt_router_listen_socket_rpc_create(nxt_task_t *task, goto fail; } + b->completion_handler = nxt_router_dummy_buf_completion; + b->mem.free = nxt_cpymem(b->mem.free, skcf->listen->sockaddr, size); rt = task->thread->runtime; @@ -2446,6 +2450,8 @@ nxt_router_app_rpc_create(nxt_task_t *task, goto fail; } + b->completion_handler = nxt_router_dummy_buf_completion; + nxt_buf_cpystr(b, &app->name); *b->mem.free++ = '\0'; nxt_buf_cpystr(b, &app->conf); @@ -3469,6 +3475,8 @@ nxt_router_access_log_open(nxt_task_t *task, nxt_router_temp_conf_t *tmcf) goto fail; } + b->completion_handler = nxt_router_dummy_buf_completion; + nxt_buf_cpystr(b, &access_log->path); *b->mem.free++ = '\0'; |