Stream read hangs when stream is closed during a BYOB read #1321
Open
Description
When constructing a ReadableStream and then reading it with a ReadableStreamBYOBReader (for example to control the size of reads), if the stream is closed during the read request without enqueued data, the read request hangs. This is problematic when the stream is used from a library by unknown callers. The solution is to not ignore BYOB in the stream implementation and call close()
followed by controller.byobRequest.respond(0)
, but that is unexpected when the readable stream otherwise ignores BYOB. Why isn't calling close()
alone sufficient?
More detail, code examples, and the workaround can be found in this Stack Overflow question: https://stackoverflow.com/questions/78804588/why-does-read-not-return-in-byob-mode-when-stream-is-closed
Metadata
Assignees
Labels
No labels