From 9b03af254a26dc3d795f95a374e7ba83f3ec9f84 Mon Sep 17 00:00:00 2001 From: Tom Atkinson Date: Tue, 19 Jan 2016 23:16:55 +0100 Subject: [PATCH] http: remove reference to onParserExecute Parsers hold a reference to the socket associated with the request through onParserExecute. This must be removed when the parser is freed so that the socket can be garbage collected when destroyed. Regression introduced in commit 59b91f1 ("http_parser: consume StreamBase instance"). PR-URL: https://github.com/nodejs/node/pull/4773 Reviewed-By: Ben Noordhuis Reviewed-By: Brian White Reviewed-By: Fedor Indutny --- lib/_http_common.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/_http_common.js b/lib/_http_common.js index 5140d366661cb4..f6557c09e284cf 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -20,6 +20,7 @@ const kOnHeaders = HTTPParser.kOnHeaders | 0; const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0; const kOnBody = HTTPParser.kOnBody | 0; const kOnMessageComplete = HTTPParser.kOnMessageComplete | 0; +const kOnExecute = HTTPParser.kOnExecute | 0; // Only called in the slow case where slow means // that the request headers were either fragmented @@ -151,6 +152,7 @@ var parsers = new FreeList('parsers', 1000, function() { parser[kOnHeadersComplete] = parserOnHeadersComplete; parser[kOnBody] = parserOnBody; parser[kOnMessageComplete] = parserOnMessageComplete; + parser[kOnExecute] = null; return parser; }); @@ -175,6 +177,7 @@ function freeParser(parser, req, socket) { parser.socket.parser = null; parser.socket = null; parser.incoming = null; + parser[kOnExecute] = null; if (parsers.free(parser) === false) parser.close(); parser = null;