[rush-lib] Fix issue with MaxListenersExceeded
while using the HTTP build cache plugin
#5073
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Removes unnecessary error handling when dealing with ECONNRESET-like errors. Fixes #5061.
Details
An error handler was added to the socket to deal with ECONNRESET and other ECONN* errors that seemingly wouldn't bubble up. These errors were difficult to validate the fix against, so minimal testing of the change was done. However, errors began to arrise due to socket reuse in the http/https libraries during periods of high request utilization against the same host, leading to too many error handlers being added to individual sockets.
This change removes the socket handler, as we validated by looking at Node source code that socket errors should bubble up to the request error handler. See: https://github.com/nodejs/node/blob/14b6317641751590ebe5d87d4f15822ae3fdb7d6/lib/_http_client.js#L497
How it was tested
Locally calling the HTTP library and confirming that easy-to-reproduce ECONN* errors would bubble up to the request error handler.
Impacted documentation
N/A