Skip to content

Fix multicast subscriber cancellation and document shared ownership - #66

Merged
twittemb merged 2 commits into
mainfrom
codex/fix-multicast-consumer-lifetime
Oct 3, 2026
Merged

twittemb merged 2 commits into
mainfrom
codex/fix-multicast-consumer-lifetime

Conversation

@twittemb

@twittemb twittemb commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

When a subscriber was cancelled while the shared upstream was suspended, multicast kept that subscriber waiting for an upstream value before it could finish. Upstream demand now runs under the shared sequence's ownership while each subscriber awaits its own cancellable subject channel.

Documents the other cause of #31's crash: creating a fresh multicast/share wrapper for every call creates multiple upstream iterators. The README includes a connection that stores and returns one shared instance; no global deduplication or cross-instance sharing is added.

Validation: reproduced the cancellation hang before the fix; regressions cover cancellation without cancelling the shared stream and two consumers of the cached connection. All 175 tests pass on Swift 6.4/macOS, including concurrent delivery ordering and finish/failure tests.

Fixes #31.

@twittemb
twittemb force-pushed the codex/fix-multicast-consumer-lifetime branch from 83b8327 to 3cde907 Compare October 3, 2026 11:45
@twittemb
twittemb merged commit 6b7a079 into main Oct 3, 2026
2 checks passed
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

Successfully merging this pull request may close these issues.

[BUG] attempt to await next() on more than one task

1 participant