-
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.Readable.from does not always close synchronous generators #32842
Labels
stream
Issues and PRs related to the stream subsystem.
Comments
3 tasks
vadzim
added a commit
to vadzim/node
that referenced
this issue
Apr 14, 2020
Use for-of loop to traverse iterator and properly close it if not all of its values are consumed. Fixes: nodejs#32842
vadzim
added a commit
to vadzim/node
that referenced
this issue
Apr 15, 2020
Call iterator.return() if not all of its values are consumed. Fixes: nodejs#32842
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the bug?
If synchronous generator wrapped with
stream.Readable.from
emits rejectedPromise
then finally blocks of that generator is never called.But if that generator is consumed with general
for-of
loop thenfinally
blocks are called as expected.It logs
but does not log
fin
.How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
stream.Readable.from
should either not resolvePromise
s yielded from synchronous generators and should pass unresolvedPromise
s to the returned stream or should properly close generator even if it yields rejectedPromise
.Additional information
To fix this there should be called
iterator.return
ifawait value
throws.node/lib/internal/streams/from.js
Line 57 in f21cf45
The text was updated successfully, but these errors were encountered: