Uh oh!
There was an error while loading. Please reload this page.
stream: improve Readable.from error handling - #37158
Conversation
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
This is tricky and I want feedback on the semantics, basically:
- If we had an error (
.destroy(err)) we call.throw- this aligns the behaviour of.fromwith other methods and means stuff likeaddAbortSignalautomagically "works". - If after calling
throwthe iterator did not finish - we also call.return
There was a problem hiding this comment.
This check is no longer necessary without needToClose since _destroy is called and if the stream is destroyed the iterator is closed.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Wouldn't error be null?
node/lib/internal/streams/destroy.js
Line 67 in 683754c
3f712a5 to
0bce498Compareaduh95
commented
Feb 1, 2021
I've rebased and force pushed to solve to git conflicts introduced by my PR. |
benjamingr
commented
Feb 1, 2021
@aduh95 very kind of you, thanks 🙇♂️ |
nodejs-github-bot
commented
Feb 1, 2021
nodejs-github-bot
commented
Feb 2, 2021
nodejs-github-bot
commented
Feb 2, 2021
@mcollina I might be a bit overcautious* - but I prefer to err on the side of caution. What steps can I take to ensure there is less breakage here? Thoughts:
Anything else? (since the old behaviour was just an overlooked bug/edge-case and probably not relied on) |
benjamingr
commented
Feb 2, 2021
Putting "blocked" so this doesn't land by accident in the meantime. |
benjamingr
commented
Feb 2, 2021
I went through most CITGM failures and there don't seem to be new/related ones |
nodejs-github-bot
commented
Feb 2, 2021
nodejs-github-bot
commented
Feb 2, 2021
nodejs-github-bot
commented
Feb 3, 2021
mcollina
commented
Feb 3, 2021
I do not think we have any modules using this in CITGM. It's not touching any old/critical APIs, so it should be good to land. |
benjamingr
commented
Feb 3, 2021
Thanks matteo. Landed in 03380bc |
PR-URL: #37158 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #37158 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Notable Changes: * crypto: * add keyObject.export() 'jwk' format option (Filip Skokan) #37081 * deps: * upgrade to libuv 1.41.0 (Colin Ihrig) #37360 * doc: * add dmabupt to collaborators (Xu Meng) #37377 * refactor fs docs structure (James M Snell) #37170 * fs: * add fsPromises.watch() (James M Snell) #37179 * use a default callback for fs.close() (James M Snell) #37174 * add AbortSignal support to watch (Benjamin Gruenbaum) #37190 * perf_hooks: * introduce createHistogram (James M Snell) #37155 * stream: * improve Readable.from error handling (Benjamin Gruenbaum) #37158 * timers: * introduce setInterval async iterator (linkgoron) #37153 * tls: * add ability to get cert/peer cert as X509Certificate object (James M Snell) #37070
Notable Changes: * crypto: * add keyObject.export() 'jwk' format option (Filip Skokan) #37081 * deps: * upgrade to libuv 1.41.0 (Colin Ihrig) #37360 * doc: * add dmabupt to collaborators (Xu Meng) #37377 * refactor fs docs structure (James M Snell) #37170 * fs: * add fsPromises.watch() (James M Snell) #37179 * use a default callback for fs.close() (James M Snell) #37174 * add AbortSignal support to watch (Benjamin Gruenbaum) #37190 * perf_hooks: * introduce createHistogram (James M Snell) #37155 * stream: * improve Readable.from error handling (Benjamin Gruenbaum) #37158 * timers: * introduce setInterval async iterator (linkgoron) #37153 * tls: * add ability to get cert/peer cert as X509Certificate object (James M Snell) #37070
PR-URL: #37406 Notable Changes: * crypto: * add keyObject.export() jwk format option (Filip Skokan) #37081 * deps: * upgrade to libuv 1.41.0 (Colin Ihrig) #37360 * doc: * add dmabupt to collaborators (Xu Meng) #37377 * refactor fs docs structure (James M Snell) #37170 * fs: * add fsPromises.watch() (James M Snell) #37179 * use a default callback for fs.close() (James M Snell) #37174 * add AbortSignal support to watch (Benjamin Gruenbaum) #37190 * perf_hooks: * introduce createHistogram (James M Snell) #37155 * stream: * improve Readable.from error handling (Benjamin Gruenbaum) #37158 * timers: * introduce setInterval async iterator (linkgoron) #37153 * tls: * add ability to get cert/peer cert as X509Certificate object (James M Snell) #37070
PR-URL: #37406 Notable Changes: * crypto: * add keyObject.export() jwk format option (Filip Skokan) #37081 * deps: * upgrade to libuv 1.41.0 (Colin Ihrig) #37360 * doc: * add dmabupt to collaborators (Xu Meng) #37377 * refactor fs docs structure (James M Snell) #37170 * fs: * add fsPromises.watch() (James M Snell) #37179 * use a default callback for fs.close() (James M Snell) #37174 * add AbortSignal support to watch (Benjamin Gruenbaum) #37190 * perf_hooks: * introduce createHistogram (James M Snell) #37155 * stream: * improve Readable.from error handling (Benjamin Gruenbaum) #37158 * timers: * introduce setInterval async iterator (linkgoron) #37153 * tls: * add ability to get cert/peer cert as X509Certificate object (James M Snell) #37070
This pull request aligns the behaviour of
Readable.fromwith other stream behaviours namely:.throwand not via.onand reach catch blocks. This means things likeaddAbortSignalwork withReadable.fromnow.nextwas not called - this is because the previous implementation had a timing bug where ifnextwas called and the stream was destroyed in the same tick - finally blocks would not run.cc @ronag@mcollina @nodejs/streams