Skip to content

Conversation

@greguz
Copy link
Contributor

@greguzgreguz commented Jun 21, 2022

While looking at readable-stream source, I've found a possible missed argument while emitting an error toward legacy streams.

  • Include tests for any bug fixes or new features.
  • Update documentation if relevant.
  • Ensure that make lint passes.
  • Ensure that make -j4 test (UNIX), or vcbuild test (Windows) passes.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 21, 2022
@mscdex
Copy link
Contributor

This needs a test

@greguzgreguz changed the title streams: pass error on legacy destroystream: pass error on legacy destroyJun 21, 2022
@greguz
Copy link
ContributorAuthor

greguz commented Jun 21, 2022

@mscdex I came out (about tests) with this:

test/parallel/test-stream-pipeline.js

{// Mimics a legacy stream without the .destroy methodclassLegacyWritableextendsStream{write(chunk,encoding,callback){callback();}}constwritable=newLegacyWritable();writable.on('error',common.mustCall((err)=>{assert.deepStrictEqual(err,newError('stop'));}));pipeline(Readable.from({[Symbol.asyncIterator](){return{next(){returnPromise.reject(newError('stop'));}};}}),writable,common.mustCall((err)=>{assert.deepStrictEqual(err,newError('stop'));}));}

I have to say that this is a very specific edge case. The only way to trigger the bug is to use either finished or compose functions provided by the stream subsystem in combination with not-so-standard stream instances.

Copy link
Member

@benjamingrbenjamingr left a comment

Choose a reason for hiding this comment

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

The test looks fine (it's indeed an edge case but the test is needed to make sure we don't cause a regression in the future)

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@mcollinamcollina added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed needs-ci PRs that need a full CI run. labels Jun 28, 2022
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 28, 2022
@nodejs-github-botnodejs-github-bot merged commit 51beb26 into nodejs:mainJun 28, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 51beb26

@greguzgreguz deleted the streams-legacy-error branch July 1, 2022 19:13
targos pushed a commit that referenced this pull request Jul 12, 2022
PR-URL: #43519 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
@targostargos mentioned this pull request Jul 12, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@greguz@nodejs-github-bot@mscdex@mcollina@jasnell@benjamingr@lpinca@ronag@JungMinu@targos