summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_h1proto.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-04-16 17:09:23 +0300
committerMax Romanov <max.romanov@nginx.com>2020-04-16 17:09:23 +0300
commit6bda9b5eeb2b6c99c54f5b314b8eb96d72af3542 (patch)
tree83ce2d661b00408e911c74850b7024a4e9cd07c8 /src/nxt_h1proto.c
parentee62736a11acc4b699102a1260c6a8c5f57c1fef (diff)
downloadunit-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_h1proto.c')
-rw-r--r--src/nxt_h1proto.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index c2e65397..a139f611 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -186,16 +186,16 @@ static nxt_http_field_proc_t nxt_h1p_peer_fields[] = {
nxt_int_t
-nxt_h1p_init(nxt_task_t *task, nxt_runtime_t *rt)
+nxt_h1p_init(nxt_task_t *task)
{
nxt_int_t ret;
- ret = nxt_http_fields_hash(&nxt_h1p_fields_hash, rt->mem_pool,
+ ret = nxt_http_fields_hash(&nxt_h1p_fields_hash,
nxt_h1p_fields, nxt_nitems(nxt_h1p_fields));
if (nxt_fast_path(ret == NXT_OK)) {
ret = nxt_http_fields_hash(&nxt_h1p_peer_fields_hash,
- rt->mem_pool, nxt_h1p_peer_fields,
+ nxt_h1p_peer_fields,
nxt_nitems(nxt_h1p_peer_fields));
}