FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stream: error state timing by ronag · Pull Request #30851 · nodejs/node · GitHub

/ node Public

stream: error state timing - #30851

Closed
ronag wants to merge 2 commits into
nodejs:masterfrom
nxtedition:stream-error-cleanup
Closed

ronag wants to merge 2 commits into
nodejs:masterfrom
nxtedition:stream-error-cleanup

Conversation

ronag commented Dec 8, 2019
edited
Loading

Copy link
Copy Markdown
Member

Fix, clean up and simplify errored state.

  • errorEmitted should be set in the same tick as 'error' is emitted.
  • fix an edge case where errored was not set (if receiving error through _destroy)
  • errored should exist on Readable as well.
  • refactor destroy logic and make it easier to follow.

errorEmitted is currently set in a tick before 'error' is actually emitted which is a bit confusing (and inconsistent with other event has been emitted state, e.g. endEmitted). If we need to know the synchronous error state we should use errored.

There was a potential race in console (at least in theory). We want to swallow an error if it's about to be emitted. However, since errorEmitted was set to true in the tick before the error is actually emitted, the "swallow error" logic might not be applied if the timing is unfortunate.

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 added console Issues and PRs related to the console subsystem. stream Issues and PRs related to Node.js streams. labels Dec 8, 2019
ronag force-pushed the stream-error-cleanup branch 3 times, most recently from 757667b to 8cda582 Compare December 8, 2019 09:52

This comment has been minimized.

ronag force-pushed the stream-error-cleanup branch 3 times, most recently from b365b0e to dc03c53 Compare December 8, 2019 10:12
Clean up end simplify errored state.

- errorEmitted should be set in the same tick as 'error' is emitted.
- errored should be set as soon as an error occurs.
- errored should exist on Readable as well.
- refactor destroy logic and make it easier to follow.
ronag force-pushed the stream-error-cleanup branch from dc03c53 to 20a2a29 Compare December 8, 2019 10:14

ronag commented Dec 8, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

since this slightly changes timing it should probably be semver-major, even if it only applies to "internal" state.

ronag changed the title stream: error state cleanup stream: error state timing Dec 8, 2019
Trott added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 8, 2019

lpinca commented Dec 9, 2019

Copy link
Copy Markdown
Member

@nodejs/streams

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should we change the docs on any of this at all?

LGTM

ronag commented Dec 9, 2019

Copy link
Copy Markdown
Member Author

Should we change the docs on any of this at all?

I don't think so. Did you have anything specific in mind? This mostly affects internal details and is how I think it is expected to work.

mcollina commented Dec 9, 2019

Copy link
Copy Markdown
Member

No, not really.

addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Dec 14, 2019

nodejs-github-bot commented Dec 14, 2019
edited by addaleax
Loading

Copy link
Copy Markdown
Collaborator

ronag commented Dec 14, 2019

Copy link
Copy Markdown
Member Author

This need another TSC approval. Maybe @addaleax?

Copy link
Copy Markdown
Collaborator

nodejs-github-bot commented Dec 15, 2019
edited by BridgeAR
Loading

Copy link
Copy Markdown
Collaborator

BridgeAR pushed a commit that referenced this pull request Dec 15, 2019
Clean up end simplify errored state.

- errorEmitted should be set in the same tick as 'error' is emitted.
- errored should be set as soon as an error occurs.
- errored should exist on Readable as well.
- refactor destroy logic and make it easier to follow.

PR-URL: #30851
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

Copy link
Copy Markdown
Member

Landed in 67ed526 🎉

BridgeAR closed this Dec 15, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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. console Issues and PRs related to the console subsystem. 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.

7 participants


Back | FazBrowse Home | New Git URL