Skip to content

Canceling a locked readable stream shouldn't throw #58399

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

Open
andreas-karlsson opened this issue May 20, 2025 · 1 comment
Open

Canceling a locked readable stream shouldn't throw #58399

andreas-karlsson opened this issue May 20, 2025 · 1 comment

Comments

@andreas-karlsson
Copy link

Version

v23.9.0

Platform

Linux f2e88f5c8079 6.10.14-linuxkit #1 SMP Thu Mar 20 16:32:56 UTC 2025 aarch64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Reading from the body stream of an aborted fetch request will sometimes just hang due to readable stream throwing on cancel.

How often does it reproduce? Is there a required condition?

We've only managed to reproduce it in a docker container with resource constrained cpu.

What is the expected behavior? Why is that the expected behavior?

Canceling a locked readable stream shouldn't throw. Relevant spec. https://streams.spec.whatwg.org/#readable-stream-close

What do you see instead?

Canceling a stream throws if the stream is locked.

Additional information

Here is where the an error is thrown if the stream is locked. Which isn't mentioned in the relevant spec.

This is believed to be the source of the following bug in undici nodejs/undici#4232

@andreas-karlsson
Copy link
Author

Ok I found this previous issue that challenges the same thing and where it was deemed to be correct behaviour. #41159

Interesting then what does the fetch spec intend to happen when you abort a request who's response stream is being read. The current behaviour of a promise hanging forever can hardly be the desired behaviour, but maybe there's some issue in undicis implementation of reading the body? Or I would expect it should hold the lock until it's done reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant