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

[v12.x backport] stream: destroy wrapped streams on error #35557

Closed
wants to merge 1 commit into from

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Oct 8, 2020

Stream should be destroyed and update state accordingly when
the wrapped stream emits error.

Does some additional cleanup with future TODOs that might be worth
looking into.

PR-URL: #34102
Reviewed-By: Matteo Collina matteo.collina@gmail.com
Reviewed-By: Luigi Pinca luigipinca@gmail.com
Reviewed-By: Anna Henningsen anna@addaleax.net

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added stream Issues and PRs related to the stream subsystem. v12.x labels Oct 8, 2020
@lpinca
Copy link
Member Author

lpinca commented Oct 8, 2020

cc: @ronag

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@lpinca
Copy link
Member Author

lpinca commented Oct 8, 2020

The test fails, I guess this depends on something else.

@lpinca lpinca added the blocked PRs that are blocked by other issues or PRs. label Oct 8, 2020
@lpinca
Copy link
Member Author

lpinca commented Oct 8, 2020

Adapted to v12.x destroy() implementation. PTAL.

@lpinca
Copy link
Member Author

lpinca commented Oct 8, 2020

It still fails as the error is emitted twice. I think we can't backport this.

The problem was that the same EventEmitter instance (oldStream) was used in both tests so two 'error' listeners were added.

@ronag
Copy link
Member

ronag commented Oct 8, 2020

It still fails as the error is emitted twice. I think we can't backport this.

You could change the test to allow it being emitted twice.

@lpinca
Copy link
Member Author

lpinca commented Oct 8, 2020

I found a better fix.

@lpinca lpinca added request-ci Add this label to start a Jenkins CI on a PR. and removed blocked PRs that are blocked by other issues or PRs. labels Oct 8, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 8, 2020
@nodejs-github-bot
Copy link
Collaborator

Stream should be destroyed and update state accordingly when
the wrapped stream emits error.

Does some additional cleanup with future TODOs that might be worth
looking into.

PR-URL: nodejs#34102
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
lpinca added a commit to lpinca/node that referenced this pull request Oct 12, 2020
Prevent multiple listeners for the `'error'` event to be added to the
same `EventEmitter` instance.

PR-URL: nodejs#35560
Refs: nodejs#35557 (comment)
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Oct 14, 2020
Prevent multiple listeners for the `'error'` event to be added to the
same `EventEmitter` instance.

PR-URL: #35560
Refs: #35557 (comment)
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 3, 2020
Stream should be destroyed and update state accordingly when
the wrapped stream emits error.

Does some additional cleanup with future TODOs that might be worth
looking into.

Backport-PR-URL: #35557
PR-URL: #34102
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorins
Copy link
Member

landed in e40b78c

@MylesBorins MylesBorins closed this Nov 3, 2020
@lpinca lpinca deleted the backport-34102-to-v12.x branch November 3, 2020 17:44
MylesBorins pushed a commit that referenced this pull request Nov 16, 2020
Stream should be destroyed and update state accordingly when
the wrapped stream emits error.

Does some additional cleanup with future TODOs that might be worth
looking into.

Backport-PR-URL: #35557
PR-URL: #34102
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Prevent multiple listeners for the `'error'` event to be added to the
same `EventEmitter` instance.

PR-URL: nodejs#35560
Refs: nodejs#35557 (comment)
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants