http: avoid stream listeners on idle agent sockets#64004
Open
mcollina wants to merge 1 commit into
Open
Conversation
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Collaborator
|
Review requested:
|
Member
Author
|
@nodejs/releasers unfortunately, we would need to backport this to node 22.x and 24.x to fix node-fetch@2. |
Member
Author
|
I'm sorry I should have caught this before shipping. |
Renegade334
approved these changes
Jun 19, 2026
Renegade334
left a comment
Member
There was a problem hiding this comment.
Side-note: I had a cursory look for guidance on Node.js internals managing EventEmitter events on emitter-derived Node.js classes, and found none. My feeling is that we don't ordinarily consider changes related to internally-managed event listeners to be semver-major, even though they're publicly observable. Maybe we should elucidate what our stance is, and make it explicit in the EventEmitter documentation?
Contributor
|
Fast-track has been requested by @Renegade334. Please 👍 to approve. |
anonrig
approved these changes
Jun 19, 2026
2 tasks
bjohansebas
approved these changes
Jun 19, 2026
Collaborator
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.
Fixes: #63989
The response-queue-poisoning guard added to idle
http.Agentsockets used a public'data'listener. That madenode-fetch@2observesocket.listenerCount('data') > 0during response close and report falseERR_STREAM_PREMATURE_CLOSEerrors.This changes the idle-socket guard to use the socket handle's internal
onreadhook while the socket is in the free pool, restoring the normal stream read callback when the socket is reused. The guard still destroys sockets that receive unsolicited data while idle, but it no longer adds public stream listeners.