From 153e8a87792ecc5dee12ba1f261fe1340a800a90 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 30 Sep 2020 01:17:09 +0300 Subject: [PATCH] Fixing leakage caused by incorrect in_hash flag cleanup. Large-bodied requests are added to the request hash to be found when the body arrives. However, changeset 1d84b9e4b459 introduced a bug: the 'in_hash' flag, used to remove the request from the hash at request release, was cleared after the first successful request lookup. As a result, the entry was never removed. --- src/nxt_unit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nxt_unit.c b/src/nxt_unit.c index a4015ce5..28295e22 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -6202,7 +6202,9 @@ nxt_unit_request_hash_find(nxt_unit_ctx_t *ctx, uint32_t stream, int remove) case NXT_OK: req_impl = nxt_container_of(lhq.value, nxt_unit_request_info_impl_t, req); - req_impl->in_hash = 0; + if (remove) { + req_impl->in_hash = 0; + } return lhq.value;