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

releasing lock of reader whose stream is still in readable state when cancelling a TransformStream #13816

Closed
refi64 opened this issue Sep 9, 2024 · 0 comments · Fixed by #13906
Labels
bug Something isn't working web:stream wintercg Web-interoperable Runtimes Community Group compatiblity

Comments

@refi64
Copy link
Contributor

refi64 commented Sep 9, 2024

What version of Bun is running?

1.1.27+267afa293

What platform is your computer?

Linux 6.9.12-400.asahi.fc40.aarch64+16k aarch64 unknown

What steps can reproduce the bug?

let s = new ReadableStream({start(controller) {
  controller.enqueue('123')
  setTimeout(() => {
    controller.enqueue('456')
    controller.close()
  }, 200)
}})
let ts = new TransformStream()
let p = s.pipeTo(ts.writable, {preventCancel: true})

await ts.readable.cancel('cancelled!')

try {
  await p
} catch (err) {
  console.log(`pipeTo: ${err}`)
}

let r = s.getReader()
console.log(await r.read())
console.log(await r.read())

What is the expected behavior?

In all of {Node, Chromium, Firefox, Epiphany (uses WebKit)}, the output is:

pipeTo: cancelled!
{ value: '456', done: false }
{ value: undefined, done: true }

What do you see instead?

pipeTo: cancelled!
1 | (function (pipeState) {"use strict";
              ^
TypeError: releasing lock of reader whose stream is still in readable state
{
  value: "456",
  done: false,
}
{
  value: undefined,
  done: true,
}

Bun v1.1.27 (Linux arm64)

I can't actually tell where the TypeError is coming from.

Additional information

No response

@refi64 refi64 added bug Something isn't working needs triage labels Sep 9, 2024
Jarred-Sumner pushed a commit that referenced this issue Sep 12, 2024
Ignore ERR_STREAM_RELEASE_LOCK in process.stdin

Reject pending reads when a ReadableStream's lock is released

WebKit/WebKit@f8ae40c

Update the ReadableStream promise resolution ordering on pull rejection

WebKit/WebKit@1f74c15

Fix pipeThrough unhandled rejections on readable errors

WebKit/WebKit@07e4b92

Fix pipeTo unhandled rejections on readable errors

WebKit/WebKit@3a75b5d

Fixes #13816.
@nektro nektro added web:stream wintercg Web-interoperable Runtimes Community Group compatiblity and removed needs triage labels Oct 9, 2024
pfgithub pushed a commit that referenced this issue Oct 29, 2024
Ignore ERR_STREAM_RELEASE_LOCK in process.stdin

Reject pending reads when a ReadableStream's lock is released

WebKit/WebKit@f8ae40c

Update the ReadableStream promise resolution ordering on pull rejection

WebKit/WebKit@1f74c15

Fix pipeThrough unhandled rejections on readable errors

WebKit/WebKit@07e4b92

Fix pipeTo unhandled rejections on readable errors

WebKit/WebKit@3a75b5d

Fixes #13816.
pfgithub pushed a commit that referenced this issue Oct 29, 2024
Ignore ERR_STREAM_RELEASE_LOCK in process.stdin

Reject pending reads when a ReadableStream's lock is released

WebKit/WebKit@f8ae40c

Update the ReadableStream promise resolution ordering on pull rejection

WebKit/WebKit@1f74c15

Fix pipeThrough unhandled rejections on readable errors

WebKit/WebKit@07e4b92

Fix pipeTo unhandled rejections on readable errors

WebKit/WebKit@3a75b5d

Fixes #13816.
pfgithub pushed a commit that referenced this issue Nov 1, 2024
Ignore ERR_STREAM_RELEASE_LOCK in process.stdin

Reject pending reads when a ReadableStream's lock is released

WebKit/WebKit@f8ae40c

Update the ReadableStream promise resolution ordering on pull rejection

WebKit/WebKit@1f74c15

Fix pipeThrough unhandled rejections on readable errors

WebKit/WebKit@07e4b92

Fix pipeTo unhandled rejections on readable errors

WebKit/WebKit@3a75b5d

Fixes #13816.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working web:stream wintercg Web-interoperable Runtimes Community Group compatiblity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants