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.
This commit is contained in:
@@ -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,
|
static void nxt_router_http_request_done(nxt_task_t *task, void *obj,
|
||||||
void *data);
|
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,
|
static void nxt_router_app_prepare_request(nxt_task_t *task,
|
||||||
nxt_request_rpc_data_t *req_rpc_data);
|
nxt_request_rpc_data_t *req_rpc_data);
|
||||||
static nxt_buf_t *nxt_router_prepare_msg(nxt_task_t *task,
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b->completion_handler = nxt_router_dummy_buf_completion;
|
||||||
|
|
||||||
b->mem.free = nxt_cpymem(b->mem.free, skcf->listen->sockaddr, size);
|
b->mem.free = nxt_cpymem(b->mem.free, skcf->listen->sockaddr, size);
|
||||||
|
|
||||||
rt = task->thread->runtime;
|
rt = task->thread->runtime;
|
||||||
@@ -2446,6 +2450,8 @@ nxt_router_app_rpc_create(nxt_task_t *task,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b->completion_handler = nxt_router_dummy_buf_completion;
|
||||||
|
|
||||||
nxt_buf_cpystr(b, &app->name);
|
nxt_buf_cpystr(b, &app->name);
|
||||||
*b->mem.free++ = '\0';
|
*b->mem.free++ = '\0';
|
||||||
nxt_buf_cpystr(b, &app->conf);
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b->completion_handler = nxt_router_dummy_buf_completion;
|
||||||
|
|
||||||
nxt_buf_cpystr(b, &access_log->path);
|
nxt_buf_cpystr(b, &access_log->path);
|
||||||
*b->mem.free++ = '\0';
|
*b->mem.free++ = '\0';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user