You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to completely read data from 'bytes' ReadableStream #48233
The stream should consume all the elements in the toPull array and we must be able to subsequently read this data back, the behaviour is correct in chrome.
I tried investigating a little, its possible that there is some hanging promise before the closing of the stream. for example if you logged the values in each step the output would be like this
debadreechatterjee@Debadree-MacBook-Pro node % node test3.mjsread value aread value bread value cread value dread value eread value fread value gread value hread value iread value jdebadreechatterjee@Debadree-MacBook-Pro node %
note that console to print the chunks array is not printed
I found the issue and have a fix, I'll create a PR later.
From what I've found, readableStreamClose incorrectly handles only StreamDefaultReader correctly and not BYOB. If you look at readableStreamError in comparison it handles both BYOB and default.
I take back my previous statement... I think I understand what the issue is, and I managed to create a fix (at least it passed both wpt tests and Node's own tests) - however as I understand it - the implementation is directly from the spec. I checked and this also reproduces on Deno as well.
Activity
[-]Promise hang in 'bytes' ReadableStream[/-][+]Unable to completely read data from 'bytes' ReadableStream[/+]debadree25 commentedon Jun 5, 2023
Also cc @nodejs/whatwg-stream
Linkgoron commentedon Jun 8, 2023
I found the issue and have a fix, I'll create a PR later.
From what I've found,
readableStreamCloseincorrectly handles only StreamDefaultReader correctly and not BYOB. If you look atreadableStreamErrorin comparison it handles both BYOB and default.stream: fix ReadableStream BYOBReader read hang on close
Linkgoron commentedon Jun 9, 2023
I take back my previous statement... I think I understand what the issue is, and I managed to create a fix (at least it passed both wpt tests and Node's own tests) - however as I understand it - the implementation is directly from the spec. I checked and this also reproduces on Deno as well.
debadree25 commentedon Jun 10, 2023
Thats quite weird
is the spec wrong or does chrome deviate from the spec?
Linkgoron commentedon Jun 12, 2023
I just tried executing your code in the devtools, and I see the same behavior as in Node and Deno.
Simpler example:
debadree25 commentedon Sep 19, 2023
This is indeed spec compliant behvaiour in order to end byob streams we have to send a
controller.byobRequest.respond(0);ref: https://streams.spec.whatwg.org/#example-rbs-pull