fix(http): handle socket-only request errors without leaking keep-alive listeners#10576
Merged
jasonsaayman merged 2 commits intoaxios:v1.xfrom Apr 8, 2026
Merged
Conversation
jasonsaayman
approved these changes
Apr 8, 2026
c95c5ad to
77eef87
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
eq.destroy(err) so Axios rejects instead of leaving the error outside the request promise chain
eq.close so reused keep-alive sockets do not accumulate listeners
Notes
Closes #10558
Summary by cubic
Ensure
axiosrejects when a request’s socket emits an error, and prevent keep-alive listener leaks by removing per-request socket error listeners on close. Adds unit tests for the socket-only error path and listener cleanup. Addresses #10558.Description
req.destroy(err)so requests reject.socket.on('error', ...)and remove it onreq.once('close', ...)to avoid leaks on reused keep-alive sockets.Testing
tests/unit/adapters/http.test.js:Written for commit 77eef87. Summary will update on new commits.