Uh oh!
There was an error while loading. Please reload this page.
streams: pipeline with signal - #39067
Conversation
d9494c9 to
8578ba0CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
targos
commented
Jun 18, 2021
Can you please improve the commit message title? It should start with an imperative verb. |
nodejs-github-bot
commented
Jun 18, 2021
ronag
commented
Jun 18, 2021
@nodejs/streams |
benjamingr
left a comment
There was a problem hiding this comment.
I'm not sure this makes sense and I'll need a few days to think about this API (Sorry!).
The thing is - generators already have a way to signal cancellation (through calling .return on them which is runs finally blocks).
This is kind of scary since it behaves differently for example from doing an addAbortSignal on a Readable.from which will call .return on the generator instead of passing a signal argument.
I think Readable.from(generator) and generator should behave relatively similarly when passed to pipeline?
Is the right thing to pass an abort signal to generators passed to from and other places that accept async iterables and abort the related controller when the stream is destroyed?
benjamingr
commented
Jun 19, 2021
In any case I feel strongly that async generators should behave similarly in terms of AbortSignal in all of our APIs. |
ronag
commented
Jun 19, 2021
I’m fine with that but we need a way to abort calls inside a async generator. |
benjamingr
commented
Jun 19, 2021
And would that replace |
benjamingr
commented
Jun 19, 2021
(You can already abort it by calling |
@benjamingr I'm unsure how .return() would help with the following case... {constac=newAbortController();constsignal=ac.signal;pipelinep(asyncfunction*(signal){awaittsp.setTimeout(1e6,signal);// How to abort without passing signal?},asyncfunction(source){},{ signal }).catch(common.mustCall((err)=>{assert.strictEqual(err.name,'AbortError');}));ac.abort();} |
ronag
commented
Jun 23, 2021
@benjamingr have you given this PR any more thought? |
benjamingr
commented
Jun 24, 2021
Yes I think this should land if and only if we make Readable.from (and other APIs that take an async iterator) take a signal - otherwise we’re left with an inconsistent API - if you’re willing to do that (or wait a month for me I’ll happily contribute the code once I’m back from paternity leave) this sounds good to me. |
ronag
commented
Jun 29, 2021
I'm not sure what all those API's are and how you imagine it should look so I guess I'll wait and leave it to you. |
ronag
commented
Jun 29, 2021
I'm a little unsure if the signature should be |
benjamingr
commented
Jul 1, 2021
The latter if we follow the DOM's API design guidelines |
ronag
commented
Aug 23, 2021
@nodejs/streams |
nodejs-github-bot
commented
Aug 23, 2021
nodejs-github-bot
commented
Aug 24, 2021
nodejs-github-bot
commented
Aug 24, 2021
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Generators in pipeline must be able to be aborted or pipeline can deadlock. PR-URL: #39067 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
ronag
commented
Aug 25, 2021
Landed in c04d621 |
Generators in pipeline must be able to be aborted or pipeline can deadlock. PR-URL: #39067 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Generators in pipeline must be able to be aborted or pipeline can deadlock. PR-URL: #39067 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Notable changes: crypto: * (SEMVER-MINOR) add rsa-pss keygen parameters (Filip Skokan) #39927 doc: * add Ayase-252 to collaborators (Qingyu Deng) #40078 fs: * (SEMVER-MINOR) make `open` and `close` stream override optional when unused (Antoine du Hamel) #40013 http: * (SEMVER-MINOR) limit requests per connection (Artur K) #40082 src: * (SEMVER-MINOR) add --no-global-search-paths cli option (Cheng Zhao) #39754 * (SEMVER-MINOR) add option to disable global search paths (Cheng Zhao) #39754 * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926 stream: * (SEMVER-MINOR) add signal support to pipeline generators (Robert Nagy) #39067 PR-URL: TODO
Notable changes: crypto: * (SEMVER-MINOR) add rsa-pss keygen parameters (Filip Skokan) #39927 doc: * add Ayase-252 to collaborators (Qingyu Deng) #40078 fs: * (SEMVER-MINOR) make `open` and `close` stream override optional when unused (Antoine du Hamel) #40013 http: * (SEMVER-MINOR) limit requests per connection (Artur K) #40082 src: * (SEMVER-MINOR) add --no-global-search-paths cli option (Cheng Zhao) #39754 * (SEMVER-MINOR) add option to disable global search paths (Cheng Zhao) #39754 * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926 stream: * (SEMVER-MINOR) add signal support to pipeline generators (Robert Nagy) #39067 PR-URL: TODO
Notable changes: crypto: * (SEMVER-MINOR) add rsa-pss keygen parameters (Filip Skokan) #39927 doc: * add Ayase-252 to collaborators (Qingyu Deng) #40078 fs: * (SEMVER-MINOR) make `open` and `close` stream override optional when unused (Antoine du Hamel) #40013 http: * (SEMVER-MINOR) limit requests per connection (Artur K) #40082 src: * (SEMVER-MINOR) add --no-global-search-paths cli option (Cheng Zhao) #39754 * (SEMVER-MINOR) add option to disable global search paths (Cheng Zhao) #39754 * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926 stream: * (SEMVER-MINOR) add signal support to pipeline generators (Robert Nagy) #39067 PR-URL: #40175
Notable changes: crypto: * (SEMVER-MINOR) add rsa-pss keygen parameters (Filip Skokan) #39927 doc: * add Ayase-252 to collaborators (Qingyu Deng) #40078 fs: * (SEMVER-MINOR) make `open` and `close` stream override optional when unused (Antoine du Hamel) #40013 http: * (SEMVER-MINOR) limit requests per connection (Artur K) #40082 src: * (SEMVER-MINOR) add --no-global-search-paths cli option (Cheng Zhao) #39754 * (SEMVER-MINOR) add option to disable global search paths (Cheng Zhao) #39754 * (SEMVER-MINOR) make napi_create_reference accept symbol (JckXia) #39926 stream: * (SEMVER-MINOR) add signal support to pipeline generators (Robert Nagy) #39067 PR-URL: #40175
Generators in pipeline must be able to be aborted or pipeline
can deadlock.