From 6689a9848803fc47b0334a887e3764433d50b63d Mon Sep 17 00:00:00 2001 From: Kumar Rishav Date: Tue, 2 Apr 2024 22:01:55 +0000 Subject: [PATCH] http: remove closeIdleConnections function while calling server close Correcting the https://github.com/nodejs/node/pull/50194 backporting mistake. closeIdleConnections shouldnot be called while server.close in node v18. This behavior is for node v19 and above. Fixes: https://github.com/nodejs/node/issues/52330 Fixes: https://github.com/nodejs/node/issues/51677 PR-URL: https://github.com/nodejs/node/pull/52336 Refs: https://github.com/nodejs/node/pull/50194 Reviewed-By: Nitzan Uziely --- lib/_http_server.js | 1 - test/parallel/test-http-server-close-idle.js | 1 + test/parallel/test-https-server-close-idle.js | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/_http_server.js b/lib/_http_server.js index 0dbf11ce079156..1f90b2237f6699 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -506,7 +506,6 @@ function setupConnectionsTracking() { } function httpServerPreClose(server) { - server.closeIdleConnections(); clearInterval(server[kConnectionsCheckingInterval]); } diff --git a/test/parallel/test-http-server-close-idle.js b/test/parallel/test-http-server-close-idle.js index 36e9752d36b528..361ccf990fabcc 100644 --- a/test/parallel/test-http-server-close-idle.js +++ b/test/parallel/test-http-server-close-idle.js @@ -42,6 +42,7 @@ server.listen(0, function() { assert(response.startsWith('HTTP/1.1 200 OK\r\nConnection: keep-alive')); assert.strictEqual(connections, 2); + server.closeIdleConnections(); server.close(common.mustCall()); // Check that only the idle connection got closed diff --git a/test/parallel/test-https-server-close-idle.js b/test/parallel/test-https-server-close-idle.js index 49b525dd05f117..7f093c47cd8609 100644 --- a/test/parallel/test-https-server-close-idle.js +++ b/test/parallel/test-https-server-close-idle.js @@ -52,6 +52,7 @@ server.listen(0, function() { assert(response.startsWith('HTTP/1.1 200 OK\r\nConnection: keep-alive')); assert.strictEqual(connections, 2); + server.closeIdleConnections(); server.close(common.mustCall()); // Check that only the idle connection got closed