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 agent: remove excess calls to removeSocket #4172

Closed
wants to merge 1 commit into from

Commits on Dec 21, 2015

  1. HTTP: remove excess calls to removeSocket

    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.
    Dave committed Dec 21, 2015
    Configuration menu
    Copy the full SHA
    8bfe887 View commit details
    Browse the repository at this point in the history