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

IncomingMessage and OutgoingMessage's destroy ignores the second argument callback, swallowing the error #28236

Closed
zen0wu opened this issue Jun 14, 2019 · 3 comments
Labels
http Issues or PRs related to the http subsystem.

Comments

@zen0wu
Copy link

zen0wu commented Jun 14, 2019

  • Version: 12.4.0
  • Platform: Mac OS
  • Subsystem:

Use case: Treat a streaming HTTP response as an AsyncIterable and iterate through to do some processing.

  1. When an error happens in the async iterable stream processing,
  2. The error is propagated to the underlying stream with a callback to be triggered the rejection of the promise: https://github.com/nodejs/node/blob/49f1bb9b93/lib/internal/streams/async_iterator.js#L118
  3. When the underlying stream is IncomingMessage (in my case, or OutgoingMessage), destroy don't even take the callback, hence ignoring the error: https://github.com/nodejs/node/blob/49f1bb9b93/lib/_http_incoming.js#L102
@lpinca lpinca added the http Issues or PRs related to the http subsystem. label Jul 13, 2019
@ronag
Copy link
Member

ronag commented Jun 16, 2020

This looks like a bug. We should use finished instead of the extra callback variant of destroy.

@ronag
Copy link
Member

ronag commented Jun 16, 2020

I believe this was fixed in: #31316

@jasnell
Copy link
Member

jasnell commented Jun 26, 2020

Closing. We can reopen if it turns out that #31316 did not fix it

@jasnell jasnell closed this as completed Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants