From 609e2c2e87d1d8e5bd3dda69913f22117a5650d1 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 12 Jul 2019 00:32:21 +0200 Subject: [PATCH] http: reset parser.incoming when server response is finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This resolves a memory leak for keep-alive connections with a naïve approach. Fixes: https://github.com/nodejs/node/issues/9668 --- lib/_http_server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/_http_server.js b/lib/_http_server.js index 941d571a679273..6167c0946c289e 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -603,6 +603,7 @@ function resOnFinish(req, res, socket, state, server) { assert(state.incoming.length === 0 || state.incoming[0] === req); state.incoming.shift(); + if (socket.parser) socket.parser.incoming = null; // If the user never called req.read(), and didn't pipe() or // .resume() or .on('data'), then we call req._dump() so that the