-
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: fixes async iterator destroyed error propagation #31314
Conversation
ping @nodejs/streams bug? |
8613847
to
4eaa164
Compare
There was an edge case where if _destroy calls the error callback later than one tick the iterator would complete early and not propgate the error.
4eaa164
to
a09e59e
Compare
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.
lgtm
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was an edge case where if _destroy calls the error callback later than one tick the iterator would complete early and not propgate the error. PR-URL: #31314 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in d15b8ea |
There was an edge case where if _destroy calls the error callback later than one tick the iterator would complete early and not propgate the error. PR-URL: #31314 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Please do not backport this PR. It's causing a regression on a very simple usage of the async iterator: use strict'
const { Readable } = require('stream')
const r = new Readable({
read () {}
})
r.destroy()
async function run () {
for await (let chunk of r) {
}
}
r.on('close', () => {
console.log('close emitted')
run().then(() => console.log('finished'))
}) I'll issue a revert and add a test for it. This is not easy to fix, as we do not have a |
A test was missing for an async iterator created after the stream had emitted 'close'. This was regressed by nodejs#31314. See: nodejs#31314
A test was missing for an async iterator created after the stream had emitted 'close'. This was regressed by #31314. See: #31314 PR-URL: #31508 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
There was an edge case where if _destroy calls the error callback later than one tick the iterator would complete early and not propgate the error. PR-URL: nodejs#31314 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
There was an edge case where if _destroy calls the error callback later than one tick the iterator would complete early and not propgate the error. PR-URL: #31314 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]> PR-URL: #31700 Reviewed-By: Anna Henningsen <[email protected]>
A test was missing for an async iterator created after the stream had emitted 'close'. This was regressed by #31314. See: #31314 PR-URL: #31508 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
A test was missing for an async iterator created after the stream had emitted 'close'. This was regressed by #31314. See: #31314 PR-URL: #31508 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
There was an edge case where if _destroy calls the error callback
later than one tick the iterator would complete early and not
propgate the error.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes