Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign updoc: clarify async iterator leak #28997
Conversation
nodejs-github-bot
added
doc
stream
labels
Aug 6, 2019
ronag
force-pushed the
nxtedition:doc-async-iterator
branch
4 times, most recently
from
8a6b51d
to
5fb5109
Aug 6, 2019
This comment has been minimized.
This comment has been minimized.
|
@Trott flaky V8 compile, please restart? |
This comment has been minimized.
This comment has been minimized.
| @@ -2499,6 +2499,14 @@ and async iterators are provided below. | |||
| })(); | |||
| ``` | |||
|
|
|||
| Async iterators register a permanent error handler. If the iterator is not | |||
| fully consumed, any unhandled stream error will be swallowed. When consuming | |||
| streams using async iterators any errors emitted after `'end'` or `'close'` | |||
This comment has been minimized.
This comment has been minimized.
Trott
Aug 7, 2019
Member
| streams using async iterators any errors emitted after `'end'` or `'close'` | |
| streams using async iterators, any errors emitted after `'end'` or `'close'` |
This comment has been minimized.
This comment has been minimized.
Trott
dismissed
their
stale review
Aug 7, 2019
going to defer to stream folks on this
|
I don't think we should land this change. When a stream is async iterated it will always exit the iteration in a destroyed state, i.e. What should be documented is that, because it's left in a destroyed state, there will be a |
This comment has been minimized.
This comment has been minimized.
|
Isn’t it possible to create multiple iterators? i.e when using the iterator API directly and not through a for loop? Should we maybe throw if a second iterative is created? |
This comment has been minimized.
This comment has been minimized.
The semantics of that are currently not what somebody is going to expect. The two iterators are going to compete for the chunks (as they use |
This comment has been minimized.
This comment has been minimized.
Hence, should we throw if a secondary iterator is created? Also possibly add a note in the docs? |
ronag
force-pushed the
nxtedition:doc-async-iterator
branch
from
5fb5109
to
952d08a
Aug 7, 2019
This comment has been minimized.
This comment has been minimized.
|
Updated description in accordance with @mcollina's previous suggestion. |
This comment has been minimized.
This comment has been minimized.
|
Throwing if there's an attempt to create a second iterator would make sense to me. What do you think @mcollina? |
This comment has been minimized.
This comment has been minimized.
ronag
force-pushed the
nxtedition:doc-async-iterator
branch
from
952d08a
to
e4de3f0
Aug 9, 2019
This comment has been minimized.
This comment has been minimized.
|
@Trott: This fails because I didn't rebase master. However, since it's a simple doc change I don't think it's worth a rebase? |
This comment has been minimized.
This comment has been minimized.
| @@ -2502,6 +2502,9 @@ and async iterators are provided below. | |||
| })(); | |||
| ``` | |||
|
|
|||
| Async iterators register a permanent error handler on the stream to prevent any | |||
| unhandled post-destroy errors. | |||
This comment has been minimized.
This comment has been minimized.
Trott
Aug 12, 2019
Member
Not sure that what I"m about to suggest is a good idea, so I'll defer to everyone else's judgment:
Is it worth re-wording to make it clear that this means the destroy() method?
| unhandled post-destroy errors. | |
| unhandled errors after `destroy()` executes. |
I'm not sure that's an improvement to be honest, but maybe?
This comment has been minimized.
This comment has been minimized.
|
Landed in d7a4ace |
ronag commentedAug 6, 2019
Clarifies that creating multiple async iterators from the same stream can lead to event listener leak.
Checklist