mirror of
https://github.com/block/buzz.git
synced 2026-11-02 23:41:08 +00:00
Review (Wren) found a final shutdown race in 47193621: the one-time
TaskMeta drain only captures steered ids whose SteerAck::Success was
already processed by the main loop. A watcher can resolve during the
30s grace period — after select! stopped polling steer_ack_rx — so a
successful pending steer in that window was attached to nothing and
its 👀 died stale at process exit.
Fix: after the grace-period drain settles every prompt task (so every
ack watcher has resolved or dropped), shutdown drops its steer_ack_tx
and drains the channel (drain_crossing_steer_acks), collecting Success
event ids and removing their 👀 alongside the TaskMeta drain's ids —
both bound-awaited before exit. A per-recv 2s timeout backstops a
wedged watcher. Non-Success acks are dropped: their events were
released to the queue being discarded, the same pre-existing stale-👀
fate as any queued-but-never-dispatched event at exit.
Tests: crossing_success_ack_is_drained_and_cleaned_on_the_wire pins
the drain (Success kept, non-Success ignored, channel-close exit) and
the wire-level kind:5 deletion; crossing_ack_drain_times_out_on_wedged_watcher
(paused time) pins the no-hang backstop.
Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>