From 2de5587547247e3acdffecae1c74caf52a021580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 8 Sep 2021 10:12:23 +0200 Subject: fix(ext/http): resource leak if request body is not consumed (#11955) --- ext/http/01_http.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext') diff --git a/ext/http/01_http.js b/ext/http/01_http.js index 073cc7a7c..2e742d097 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -297,6 +297,13 @@ ws[_eventLoop](); } + } else { + // Try to close "request" resource. It might have been already consumed, + // but if it hasn't been we need to close it here to avoid resource leak. + try { + SetPrototypeDelete(httpConn.managedResources, requestRid); + core.close(requestRid); + } catch { /* pass */ } } }; } -- cgit v1.2.3