Skip to content

http: do not emit socket errors after complete response#64278

Open
Archkon wants to merge 1 commit into
nodejs:mainfrom
Archkon:http
Open

http: do not emit socket errors after complete response#64278
Archkon wants to merge 1 commit into
nodejs:mainfrom
Archkon:http

Conversation

@Archkon

@Archkon Archkon commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Fixes: #64272

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Jul 4, 2026
Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
@mcollina mcollina added the baking-for-lts PRs that need to wait before landing in a LTS release. label Jul 5, 2026
@mcollina

mcollina commented Jul 5, 2026

Copy link
Copy Markdown
Member

I fear we need to bake this a bit
or it might cause regressions.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 5, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 5, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment thread lib/_http_client.js
}

if (res) {
socket.destroy();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is redundant as the 'error' event should come from a previous socket.destroy(err) call.

@Archkon Archkon Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if a developer uses socket.emit('error')? This may be rare, but should we do not consider that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream 'error' events should not be emitted manually. It causes a lot problems. I think it was documented at some point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcollina @jasnell What is your opinion on this ?

Comment thread lib/_http_client.js
@Archkon Archkon requested review from jasnell and mcollina July 5, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baking-for-lts PRs that need to wait before landing in a LTS release. http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New ECONNRESET error on http.request for HTTP 413 (Node v24.16.0 regression)

5 participants