Skip to content

stream: pipe should not swallow error - #30993

Closed
ronag wants to merge 5 commits into
nodejs:masterfrom
nxtedition:fix-pipe-unhandled
Closed

ronag wants to merge 5 commits into
nodejs:masterfrom
nxtedition:fix-pipe-unhandled

Conversation

@ronag

@ronag ronag commented Dec 16, 2019 •

Copy link
Copy Markdown
Member

pipe would not properly forward uncaught errors.

Could be considered bug fix but I still think its semver-major.

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 nodejs-github-bot added the stream Issues and PRs related to Node.js streams. label Dec 16, 2019
@ronag

ronag commented Dec 16, 2019

Copy link
Copy Markdown
Member Author

@mcollina @lpinca

@mscdex mscdex added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 16, 2019
Comment thread lib/_stream_readable.js
dest.removeListener('error', onerror);
if (EE.listenerCount(dest, 'error') === 0) {
if (!dest.destroyed) {
const s = dest._writableState || dest._readableState;

@lpinca lpinca Dec 16, 2019 •

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.

Why dest._readableState? The stream must have a _writableState in order to be writable and be a destination no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread test/parallel/test-stream2-finish-pipe.js
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

// `socket.allowHalfOpen === false`, EOF will cause `.destroySoon()` call which
// ends the writable side of net.Socket.
w.end();
// end() must be called in nextTick or a WRITE_AFTER_END error occurs.

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.

Have we got a test that cover this case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I added a test in this PR, test-stream2-finish-pipe-error.js

@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

Comment thread test/parallel/test-stream2-finish-pipe-error.js Outdated
@nodejs-github-bot

This comment has been minimized.

@Trott

Trott commented Dec 18, 2019

Copy link
Copy Markdown
Member

@Trott Trott added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Dec 18, 2019
Comment thread test/parallel/test-stream2-finish-pipe.js Outdated
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

BridgeAR pushed a commit that referenced this pull request Dec 20, 2019
PR-URL: #30993
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@BridgeAR

Copy link
Copy Markdown
Member

Landed in 20d009d 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants