-
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 async iteration breaks when the loop body calls .destroy(null) #23890
Comments
Notably, the same error may occur with (async () => {
for await (const a of r) {
for await (const b of r) break;
}
console.log('done');
})(); as the |
@targos Unfortunately, the spec says nothing about how |
This was an unintended side effect. I’ll fix it later today. (Al that lack of prior art is why this is still experimental, sigh). |
Fixes: #23890 PR-URL: #23901 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #23890 PR-URL: #23901 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #23890 PR-URL: #23901 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #23890 PR-URL: #23901 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #23890 PR-URL: #23901 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Exiting an async iterator in a pipline early causes a `ERR_STREAM_PREMATURE_CLOSE` to be thrown. This should be fixed in a future node release: nodejs/node#23890
* fix: add buffer require Future versions of webpack will not bundle node internals so we have to `require` them as they won't be globals any more. Weirdly `buffer` was already a dep of this module but wasn't used in the actual source 🤷♂️ * fix: work around bug in node that makes writable test fail Exiting an async iterator in a pipline early causes a `ERR_STREAM_PREMATURE_CLOSE` to be thrown. This should be fixed in a future node release: nodejs/node#23890
Prints
It seems the
ERR_STREAM_PREMATURE_CLOSE
is erroneous, as I would expect the loop to terminate without error. Replacingr.destroy(null)
withr.destroy(new Error())
would result in a rejected promise with the newly created error, as expected./cc @mcollina @devsnek
Refs: #23730 #23785
The text was updated successfully, but these errors were encountered: