Skip to content
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

ReadableStreamBYOBReader read() does not cancel #17008

Open
Borewit opened this issue Feb 3, 2025 · 0 comments
Open

ReadableStreamBYOBReader read() does not cancel #17008

Borewit opened this issue Feb 3, 2025 · 0 comments
Labels
bug Something isn't working bun:test Something related to the `bun test` runner web:stream

Comments

@Borewit
Copy link

Borewit commented Feb 3, 2025

What version of Bun is running?

1.2.2+c1708ea6a

What platform is your computer?

Linux 6.11.11-300.fc41.x86_64 x86_64 unknown

What steps can reproduce the bug?

While in a pending read() operation on a ReadableStreamBYOBReader, aborting the ReadableStreamBYOBReader does not interrupt the read operation.

I have created a repository to reproduce the issue: https://github.com/Borewit/bun-abort-ReadableStreamBYOBReader-read

Bun test can the executed by:

bun run bun:test

Same tests can be executed by Node.js:

npm run node:test

What is the expected behavior?

I expect when a pending read() operation on a ReadableStreamBYOBReader to resolve with result {done: true, value: undefined} when cancel() is called.

Output of bun run bun:test, output of the cancel ReadableStreamBYOBReader test:

Reading from ReadableStreamBYOBReader...
Cancelling reader...
Stream was canceled: Canceling the reader while reading.
error: Test "cancel ReadableStreamBYOBReader" timed out after 5000ms
✗ Cancel async read operation on ReadableStream > cancel ReadableStreamBYOBReader [5000.13ms]

 1 pass
 1 fail
Ran 2 tests across 1 files. [5.02s]
error: script "bun:test" exited with code 1

What do you see instead?

ReadableStreamBYOBReader read() hangs waiting for the promise to be resolved.

Output running both tests with Node.js:

▶ Cancel async read operation on ReadableStream
  ✔ cancel ReadableStreamDefaultReader (7.421874ms)
  ✔ cancel ReadableStreamBYOBReader (0.887882ms)
✔ Cancel async read operation on ReadableStream (9.347097ms)
ℹ tests 2
ℹ suites 1
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 112.704046

Additional information

No response

@Borewit Borewit added bug Something isn't working needs triage labels Feb 3, 2025
@RiskyMH RiskyMH added bun:test Something related to the `bun test` runner web:stream and removed needs triage labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun:test Something related to the `bun test` runner web:stream
Projects
None yet
Development

No branches or pull requests

2 participants