Skip to content

Conversation

@Nibbler999
Copy link
Contributor

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.

Not removing this causes the last 1000 sockets used for inbound http requests to go uncollected after being destroyed.

Code was introduced in 59b91f1.

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.
@mscdexmscdex added the http Issues or PRs related to the http subsystem. label Jan 19, 2016
@mscdex
Copy link
Contributor

/cc @indutny

@mscdex
Copy link
Contributor

@bnoordhuis
Copy link
Member

LGTM. For mechanical sympathy it might be good to also null the property in the freelist factory function on line 231 in lib/_http_common.js.

@indutny
Copy link
Member

LGTM + what @bnoordhuis said

@mscdex
Copy link
Contributor

LGTM

@bnoordhuis
Copy link
Member

@zz85
Copy link

zz85 commented Jan 21, 2016

@Nibbler999 thanks for finding this fix! As mentioned in #4779, this seems to be of help tested against MacOS NodeJS.

While looking through this patch, along other comments I found lines 182 to be somewhat interesting too :)

// TODO: All parser data should be attached to a// single object, so that it can be easily cleaned// up by doing `parser.data ={}`, which should// be done in FreeList.free. `parsers.free(parser)`// should be all that is needed.

@ChALkeRChALkeR added the memory Issues and PRs related to the memory management or memory footprint. label Jan 21, 2016
bnoordhuis pushed a commit that referenced this pull request Jan 21, 2016
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]>
@bnoordhuis
Copy link
Member

Landed in 5f6dfab, thanks. Tagging for v5.x and LTS.

rvagg pushed a commit that referenced this pull request Jan 25, 2016
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]>
@MylesBorins
Copy link
Contributor

this must land with #4337

MylesBorins pushed a commit that referenced this pull request Mar 1, 2016
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]>
MylesBorins pushed a commit that referenced this pull request Mar 1, 2016
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]>
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
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]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
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: nodejs#4773 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

httpIssues or PRs related to the http subsystem.memoryIssues and PRs related to the memory management or memory footprint.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@Nibbler999@mscdex@bnoordhuis@indutny@zz85@MylesBorins@ChALkeR