Skip to content

Commit 313ac20

Browse files
Tom AtkinsonMyles Borins
Tom Atkinson
authored and
Myles Borins
committed
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: #4773 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 1aa4f0a commit 313ac20

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/_http_common.js

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const kOnHeaders = HTTPParser.kOnHeaders | 0;
2020
const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0;
2121
const kOnBody = HTTPParser.kOnBody | 0;
2222
const kOnMessageComplete = HTTPParser.kOnMessageComplete | 0;
23+
const kOnExecute = HTTPParser.kOnExecute | 0;
2324

2425
// Only called in the slow case where slow means
2526
// that the request headers were either fragmented
@@ -169,6 +170,7 @@ var parsers = new FreeList('parsers', 1000, function() {
169170
parser[kOnHeadersComplete] = parserOnHeadersComplete;
170171
parser[kOnBody] = parserOnBody;
171172
parser[kOnMessageComplete] = parserOnMessageComplete;
173+
parser[kOnExecute] = null;
172174

173175
return parser;
174176
});
@@ -194,6 +196,7 @@ function freeParser(parser, req, socket) {
194196
parser.socket = null;
195197
parser.incoming = null;
196198
parser.outgoing = null;
199+
parser[kOnExecute] = null;
197200
if (parsers.free(parser) === false)
198201
parser.close();
199202
parser = null;

0 commit comments

Comments
 (0)