-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 agent: remove excess calls to removeSocket #4172
Conversation
CI was all green except unrelated, flaky tests on Windows and
I'm not sure if it's a flaky test or what? |
Found it -- calling |
Hey! Been a few days, anything else I can do to give this one a kick? |
LGTM, the couple of tests that did fail are known to be flaky. |
@nodejs/http |
LGTM but would like additional review from @nodejs/http |
I see one possible problem here. LGTM |
LGTM |
Universal acclaim! Let's get this in? |
Bump! (hope it's not too pestilential to bump) |
@davidvgalbraith I would like to land this patch, but may I ask you to review this contributing guidelines first: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit, and make sure that the commit log matches them? Namely there are at least two issues with the messages right now:
Cheers! |
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in nodejs#4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request.
f02a4a3
to
8bfe887
Compare
Ok, I changed the subsystem in the title to HTTP and made the body lines ~72 characters each. |
Landed in 6e11e22, thank you! |
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in #4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: #4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in nodejs#4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: nodejs#4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in nodejs#4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: nodejs#4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in #4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: #4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in #4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: #4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy() triggers a 'close' event from the socket which triggers the onClose handler of HTTPAgent which calls self.removeSocket(). So by calling self.removeSocket() prior to socket.destroy() we end up with two calls to self.removeSocket(). If there are pending requests, removeSocket ends up creating a new socket. So if there are pending requests, each time a request completes, we tear down one socket and create two more. So the total number of sockets grows exponentially and without regard for any maxSockets settings. This was noticed in nodejs#4050. Let's get rid of the extra calls to removeSocket so we only call it once per completed request. PR-URL: nodejs#4172 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
socket.destroy()
triggers a'close'
event from the socketwhich triggers the
onClose
handler ofHTTPAgent
which callsself.removeSocket()
. So by callingself.removeSocket()
priorto
socket.destroy()
we end up with two calls toself.removeSocket()
.If there are pending requests,
removeSocket
ends up creatinga new socket. So if there are pending requests, each time
a request completes, we tear down one socket and create two
more. So the total number of sockets grows exponentially and
without regard for any
maxSockets
settings. This was noticed in#4050. Let's get rid of the extra calls to
removeSocket
so we only call it once per completed request.