diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-04-16 17:09:23 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-04-16 17:09:23 +0300 |
commit | 6bda9b5eeb2b6c99c54f5b314b8eb96d72af3542 (patch) | |
tree | 83ce2d661b00408e911c74850b7024a4e9cd07c8 /src/nxt_controller.c | |
parent | ee62736a11acc4b699102a1260c6a8c5f57c1fef (diff) | |
download | unit-6bda9b5eeb2b6c99c54f5b314b8eb96d72af3542.tar.gz unit-6bda9b5eeb2b6c99c54f5b314b8eb96d72af3542.tar.bz2 |
Using malloc/free for the http fields hash.
This is required due to lack of a graceful shutdown: there is a small gap
between the runtime's memory pool release and router process's exit. Thus, a
worker thread may start processing a request between these two operations,
which may result in an http fields hash access and subsequent crash.
To simplify issue reproduction, it makes sense to add a 2 sec sleep before
exit() in nxt_runtime_exit().
Diffstat (limited to 'src/nxt_controller.c')
-rw-r--r-- | src/nxt_controller.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/nxt_controller.c b/src/nxt_controller.c index f4c3a00d..f9b2cf26 100644 --- a/src/nxt_controller.c +++ b/src/nxt_controller.c @@ -130,14 +130,11 @@ nxt_controller_start(nxt_task_t *task, void *data) nxt_mp_t *mp; nxt_int_t ret; nxt_str_t *json; - nxt_runtime_t *rt; nxt_conf_value_t *conf; nxt_conf_validation_t vldt; nxt_controller_init_t *init; - rt = task->thread->runtime; - - ret = nxt_http_fields_hash(&nxt_controller_fields_hash, rt->mem_pool, + ret = nxt_http_fields_hash(&nxt_controller_fields_hash, nxt_controller_request_fields, nxt_nitems(nxt_controller_request_fields)); |