Re: [whatwg/streams] pipeTo: Read fulfilled after shutdown started (Issue #1207)

> But what if |source| becomes errored _during_ a pending read?

If the *source* becomes errored, then all pending and future reads must also error immediately, there's no confusion there. So the problem can only happen when *dest* becomes errored while we have a pending read.

> When working on my [new implementation](https://bugzilla.mozilla.org/show_bug.cgi?id=1734241) I actually just ended up doing what is described as option 1 (aka Chrome's behavior). My own intuition here is that it would be better to not just drop an already read chunk onto the floor and at least try to write it.

Yes, I would also expect option 2 instead of option 1. Interesting find! 🤔

Now that we have #1168, I think it would be better to *immediately* release the reader at the start of the "shutdown" and "shutdown with an action" steps, rather than as part of the "finalize" steps. That ensures that any pending reads are rejected immediately, and any unread chunks are kept in the stream's queue.

I'll give this a try with the reference implementation, and see how it would affect the behavior of the existing tests.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1207#issuecomment-1013731021

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1207/1013731021@github.com>

Received on Saturday, 15 January 2022 18:27:14 UTC