Uh oh!
There was an error while loading. Please reload this page.
http: Eliminate ClientRequest capture by Agent socket listeners - #10134
http: Eliminate ClientRequest capture by Agent socket listeners#10134evantorrie wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Can you do this without attaching to the prototype. In its current form, this will become unofficial API that we'll have to maintain.
There was a problem hiding this comment.
I changed it to just a file level function.
@cjihrig Changed per review |
There was a problem hiding this comment.
You should be able to replace self with agent now.
evantorrie
commented
Dec 7, 2016
@cjihrig Changes made as requested. |
cjihrig
left a comment
There was a problem hiding this comment.
LGTM with one small nit. CI: https://ci.nodejs.org/job/node-test-pull-request/5309/
There was a problem hiding this comment.
Can you remove this blank line.
evantorrie
commented
Dec 8, 2016
Removed the blank line. @cjihrig |
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM but can you make sure the commit log conforms to the style guide from CONTRIBUTING.md?
054d7b2 to
97f80b9Compareevantorrie
commented
Dec 9, 2016
@bnoordhuis Does that look better? Do you want me to rebase/squash? Or is that something you do on your end? |
cjihrig
commented
Dec 9, 2016
The only CI failure was the linter. Does |
Move the onFree/onClose/onRemote listeners to a separate function
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function.
evantorrie
commented
Dec 9, 2016
@cjihrig Yes, works for me: |
97f80b9 to
518d33dCompareevantorrie
commented
Dec 13, 2016
@cjihrig Is there anything more I need to do here? |
bnoordhuis
commented
Dec 13, 2016
evantorrie
commented
Dec 14, 2016
test/arm and test/smartos look like flaky failures unrelated to this change. |
evanlucas
left a comment
There was a problem hiding this comment.
LGTM. Running CI one more time to try and get a green build: https://ci.nodejs.org/job/node-test-pull-request/5418/
Thanks!
evantorrie
commented
Dec 19, 2016
These CI failures still look unrelated to this change - are the particular failing tests known to be flaky? |
evantorrie
commented
Dec 22, 2016
@evanlucas CI failure seems to be unrelated to this change. |
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. PR-URL: #10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell
commented
Jan 6, 2017
Landed in c04d4df |
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. PR-URL: nodejs#10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. PR-URL: nodejs#10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. PR-URL: nodejs#10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. PR-URL: nodejs#10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins
commented
Mar 7, 2017
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport |
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. Backport-PR-URL: #15500 PR-URL: #10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Keepalive sockets that are returned to the agent's freesocket pool were previously capturing a reference to the ClientRequest that initiated the request. This commit eliminates that by moving the installation of the socket listeners to a different function. Backport-PR-URL: #15500 PR-URL: #10134 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
http
Description of change
Eliminate capture of createSocket callback in onFree/onClose/onRemote listeners by moving them to a separate function.
Fixes#10133
This reduces the heap usage by eliminating the capture in a prior context of the ClientRequest object associated with the first call that opens a socket. Let me know the best way to provide tests for this, as it's non-obvious to me how to do so.
I have provided a heapsnapshot screen shot in the accompanying issue (#10133), and will attach a similar heapsnapshot screen shot showing usage after this fix is included.
