Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: remove reference to onParserExecute #4773

Closed
wants to merge 2 commits into from
Closed

http: remove reference to onParserExecute #4773

wants to merge 2 commits into from

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

mscdex commented Jan 20, 2016

/cc @indutny

@mscdex
Copy link
Contributor

mscdex commented Jan 20, 2016

@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

indutny commented Jan 20, 2016

LGTM + what @bnoordhuis said

@mscdex
Copy link
Contributor

mscdex commented Jan 20, 2016

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.

@ChALkeR ChALkeR 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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
@bnoordhuis
Copy link
Member

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

@bnoordhuis bnoordhuis closed this Jan 21, 2016
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
@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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. memory Issues 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