Skip to content

fix: drop all subscribers once stream is done#928

Merged
thesayyn merged 6 commits intomainfrom
fix_deadlock
Jan 22, 2026
Merged

fix: drop all subscribers once stream is done#928
thesayyn merged 6 commits intomainfrom
fix_deadlock

Conversation

@thesayyn
Copy link
Member

@thesayyn thesayyn commented Jan 20, 2026

Bug: for event in build.build_events() would deadlock because:

  1. recv() blocks waiting for channel disconnect
  2. Channel disconnect only happens when senders are dropped
  3. Senders are only dropped in join() called from wait()
  4. wait() is called after the for loop exits — but the loop never exits

Fix: Added explicit close() method to Broadcaster that drops all senders when the BES threadfinishes, triggering channel disconnect regardless of when wait() is called.

With this change, now late subscriptions via .build_events() get events replayed, the remaining build event sinks continue operate without a replayer.

@thesayyn thesayyn marked this pull request as ready for review January 20, 2026 22:56
@thesayyn thesayyn merged commit 2a995ac into main Jan 22, 2026
2 checks passed
@thesayyn thesayyn deleted the fix_deadlock branch January 22, 2026 22:34
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.

1 participant