Skip to content

stream: writable write emit all errors async - #29744

Closed
ronag wants to merge 5 commits into
nodejs:masterfrom
nxtedition:stream-writable-async-errors
Closed

ronag wants to merge 5 commits into
nodejs:masterfrom
nxtedition:stream-writable-async-errors

Conversation

@ronag

@ronag ronag commented Sep 28, 2019 •

Copy link
Copy Markdown
Member

Currently write sometimes throws/emits synchronously and sometimes asynchronously. Also, the callback is sometimes called before and sometimes after the 'error'.

This PR brings consistency in "correctly" emitting all errors in write asynchronously after the callback.

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 Sep 28, 2019
@ronag
ronag force-pushed the stream-writable-async-errors branch 3 times, most recently from cc09dcf to 37e138b Compare September 28, 2019 07:04
@ronag ronag changed the title stream: writable write emit error async stream: writable write emit all errors async Sep 28, 2019
@ronag
ronag force-pushed the stream-writable-async-errors branch 3 times, most recently from bfc0730 to bccf4b3 Compare September 28, 2019 14:15
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Trott

Trott commented Oct 4, 2019

Copy link
Copy Markdown
Member

@nodejs/streams

@ronag

ronag commented Oct 4, 2019

Copy link
Copy Markdown
Member Author

@benjamingr

@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.

I agree in principle, but I fear this might break some code.

Comment thread lib/internal/streams/destroy.js Outdated
@mcollina

mcollina commented Oct 5, 2019

Copy link
Copy Markdown
Member

@ronag

ronag commented Oct 5, 2019 •

Copy link
Copy Markdown
Member Author

New failure after pushing cosmetic fixup. I guess Travis does a rebase when running and something new in master made it fail. Investigating.

@ronag

ronag commented Oct 5, 2019

Copy link
Copy Markdown
Member Author

rebased and fixed test

@ronag
ronag force-pushed the stream-writable-async-errors branch from fc535b6 to b5ee8a9 Compare October 5, 2019 11:15

@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 semver-major PRs that contain breaking changes and should be released in the next major version. label Oct 15, 2019
@ronag

ronag commented Nov 11, 2019 •

Copy link
Copy Markdown
Member Author

@Trott @benjamingr This needs another review, ping nodejs/streams?

@Trott

Trott commented Nov 12, 2019

Copy link
Copy Markdown
Member

@nodejs/streams

@Trott

Trott commented Nov 12, 2019

Copy link
Copy Markdown
Member

/ping @nodejs/tsc this needs another review

@ronag

ronag commented Dec 1, 2019

Copy link
Copy Markdown
Member Author

@mcollina: I've brought this up to date with recent changes in master. Please take another look.

@ronag
ronag requested a review from mcollina December 1, 2019 11:11
@ronag
ronag force-pushed the stream-writable-async-errors branch 2 times, most recently from ce8b7b7 to 35225e4 Compare December 1, 2019 11:13

@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.

Still LGTM

@ronag
ronag force-pushed the stream-writable-async-errors branch 2 times, most recently from e2a49e4 to 3e59684 Compare December 1, 2019 11:34
@ronag
ronag force-pushed the stream-writable-async-errors branch from 3e59684 to 6708f17 Compare December 1, 2019 11:35
Comment thread lib/_stream_writable.js Outdated
@ronag

ronag commented Dec 30, 2019

Copy link
Copy Markdown
Member Author

@Trott: Another CITGM?

@nodejs-github-bot

nodejs-github-bot commented Dec 30, 2019 •

Copy link
Copy Markdown
Collaborator

@Trott

Trott commented Dec 30, 2019

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/28022/
CITGM: https://ci.nodejs.org/job/citgm-smoker/2167/

CITGM looks good. CI does not, but I think that's a problem on CI right now and not a problem with this PR. I'll ping the other Build folks via IRC or an issue in the build repo....

ronag added 3 commits January 1, 2020 13:35
errorOrDestroy emits 'error' synchronously due to
compat reasons. However, it should be possible to
use correct async behaviour for new code.
@ronag
ronag force-pushed the stream-writable-async-errors branch from 589e4e2 to 909706d Compare January 1, 2020 12:36
@ronag

ronag commented Jan 1, 2020

Copy link
Copy Markdown
Member Author

Rebased to fix conflicts. Needs another CI.

Comment thread test/parallel/test-zlib-write-after-close.js Outdated
Comment thread test/parallel/test-zlib-object-write.js Outdated
Comment thread test/parallel/test-zlib-object-write.js Outdated
Comment thread test/parallel/test-zlib-write-after-close.js Outdated
Comment thread test/parallel/test-zlib-write-after-close.js Outdated
Comment thread test/parallel/test-net-socket-write-error.js Outdated
Comment thread test/parallel/test-net-socket-write-error.js Outdated
Comment thread test/parallel/test-net-write-arguments.js Outdated
Comment thread test/parallel/test-net-write-arguments.js Outdated
@ronag

ronag commented Jan 1, 2020

Copy link
Copy Markdown
Member Author

CI

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronag

ronag commented Jan 4, 2020

Copy link
Copy Markdown
Member Author

@BridgeAR: Is this waiting for anything at the moment or is it just baking?

@BridgeAR

BridgeAR commented Jan 4, 2020

Copy link
Copy Markdown
Member

The CI must be green. Our process is relatively well documented. I suggest you could just check some of our markdown files :)

@BridgeAR

BridgeAR commented Jan 4, 2020

Copy link
Copy Markdown
Member

Since this is semver-major it also requires two TSC LGs.

@ronag

ronag commented Jan 4, 2020 •

Copy link
Copy Markdown
Member Author

The CI must be green.

I've never seen all CI's green (nor CITGM) and I don't quite understand the output enough to determine what is relevant and "good enough". I'll see if I can ask someone to explain it to me.

Since this is semver-major it also requires two TSC LGs.

Ah yes, this I did know. Maybe @addaleax?

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jan 4, 2020
Trott pushed a commit that referenced this pull request Jan 5, 2020
errorOrDestroy emits 'error' synchronously due to
compat reasons. However, it should be possible to
use correct async behaviour for new code.

PR-URL: #29744
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@Trott

Trott commented Jan 5, 2020

Copy link
Copy Markdown
Member

Landed in 75b30c6

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.

8 participants