-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
stream: error state timing #30851
stream: error state timing #30851
Conversation
757667b
to
8cda582
Compare
This comment has been minimized.
This comment has been minimized.
b365b0e
to
dc03c53
Compare
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.
dc03c53
to
20a2a29
Compare
since this slightly changes timing it should probably be semver-major, even if it only applies to "internal" state. |
@nodejs/streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the docs on any of this at all?
LGTM
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. |
No, not really. |
This need another TSC approval. Maybe @addaleax? |
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>
Landed in 67ed526 🎉 |
Fix, clean up and simplify errored state.
errorEmitted
should be set in the same tick as'error'
is emitted.errored
was not set (if receiving error through_destroy
)errored
should exist onReadable
as well.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 useerrored
.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, sinceerrorEmitted
was set totrue
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), orvcbuild test
(Windows) passes