Files
buzz/crates
Logan Johnson 8331e4c4be fix(relay): fence pending subscriptions on close or replacement
A REQ handler is spawned and can pause in its access checks, but it took
its subscription ID only when it registered. A CLOSE during that pause was
acknowledged and then the REQ registered anyway; an older same-ID REQ that
finished late could replace the newer one or close it with its refusal.

The read loop now admits each REQ and sync REQ in arrival order before it
spawns the handler, recording its owner token in the connection's
subscription map. Claims and in-handler refusals (CLOSED and its NOTICE)
act only while the request still owns its token, so a CLOSE or a newer
same-ID request fences a pending one.

A pubsub retain no longer waits on a full subscriber command queue while
the caller holds the lifecycle lock: it leaves a coalesced wake-up, and the
subscriber subscribes every retained topic it is missing.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Logan Johnson <loganj@squareup.com>
2026-11-06 15:19:49 -05:00
..