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
What kind of usage is ReadableStream intended for?
As shown in the example below, it is expected that when an instance of ReadableStream no longer needs to generate data, cancel() is called, and upon being called, it should stop generating data itself.
In response to this, #258 addressed the issue by preventing cancel() from being called. However, I believe the correct approach would have been to leave the code calling cancel() unchanged and instead modify the application side.
Activity
usualoma commentedon Sep 25, 2025
Hi @unnoq, thank you for your comment. We will look into it.
We may need to review the details of the following changes.
#258
usualoma commentedon Sep 27, 2025
What kind of usage is ReadableStream intended for?
As shown in the example below, it is expected that when an instance of ReadableStream no longer needs to generate data, cancel() is called, and upon being called, it should stop generating data itself.
https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream#examples
Examples mentioned in #239
In the example mentioned below, an error occurs because the generation started within
start()does not stop whencancel()is called.#239
In response to this, #258 addressed the issue by preventing
cancel()from being called. However, I believe the correct approach would have been to leave the code callingcancel()unchanged and instead modify the application side.How does it behave in other runtimes?
I have prepared the repository.
https://github.com/usualoma/hono-stream-cancel
app.ts
This is the implementation using
pull()shown in the example for this issue.When executed as follows, only node-server does not output "cancel".
app2.ts
This is the implementation in #239 that uses only
start()withoutpull().An error occurs in bun or deno.
https://github.com/usualoma/hono-stream-cancel/blob/main/fix-app2.patch
dinwwwh commentedon Sep 28, 2025
@usualoma Thanks for your response. I believe this is a critical issue that should be fixed as soon as possible.
For context: I'm the author of oRPC. We have a feature called Event Iterator, and we rely on
.cancelto trigger cleanup of the event iterator by invoking its.return. You can see the implementation here: https://github.com/unnoq/orpc/blob/main/packages/standard-server-fetch/src/event-iterator.ts#L226