AsyncStream
multi-consumptions does not propagate .finished
event to all consumers
#66541
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
As of main branch's 4d1d8a9,
AsyncStream
's underlyingAsyncStream._Storage.State.continuations
(array of continuations) management is slightly different fromAsyncThrowingStream._Storage.State.continuations
(single optional continuation) which doesn't havefatalError("attempt to await next() on more than one task")
thus causing the following multi-consumption issue which.finished
event does not propagate correctly to all consumers:Example console log:
The reason behind this is
AsyncStream._Storage.finish()
is not sending.finished
events to all managed continuations but only first one.However, due to the current nature of unshared AsyncStream by default, it might be simpler to just add
fatalError("attempt to await next() on more than one task")
forAsyncStream
as well.(Related: apple/swift-async-algorithms#110)
Expected behavior
Either one would be the expected behavior:
.finished
events to all managed continuations inAsyncStream._Storage.finish()
fatalError("attempt to await next() on more than one task")
forAsyncStream
to explicitly tell multi-consumption is disallowed.The text was updated successfully, but these errors were encountered: