Skip to content

relay: keep registry forwarders behind a ForwarderRef - #577

Open
afrind wants to merge 1 commit into
relay/registry-park-displacedfrom
relay/registry-forwarder-ref
Open

relay: keep registry forwarders behind a ForwarderRef#577
afrind wants to merge 1 commit into
relay/registry-park-displacedfrom
relay/registry-forwarder-ref

Conversation

@afrind

@afrind afrind commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

In local-forwarder mode a SubscriptionRegistry entry held a shared_ptr to a forwarder that lives on the publisher's executor, so the relay executor could read its counters, run its destructor, or hand it to a subscriber thread that later found it displaced. Entries and every view over them now hold a ForwarderRef: a caller that owns the forwarder pins it inline, and everyone else posts to its executor. Entry cleanup keys off the entry's ForwarderId instead of locking a weak_ptr, which used to decline to erase an entry exactly when its forwarder was already gone, leaving an unfulfilled promise that every later subscriber to that track waited on forever. The local-forwarder fan-out now carries a track name and executor and resolves the publisher forwarder on that executor at the point of use, so a subscriber whose hop lands late fails with "publisher forwarder gone" rather than attaching to a forwarder nobody feeds.


This change is Reviewable

@gmarzot gmarzot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarzot reviewed 6 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on afrind).

@gmarzot

gmarzot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
image

@afrind
afrind force-pushed the relay/registry-forwarder-ref branch from 39800c9 to 5a571e8 Compare August 13, 2026 22:32
In local-forwarder mode a SubscriptionRegistry entry held a shared_ptr to a
forwarder that lives on the publisher's executor, so the relay executor could
read its counters, run its destructor, or hand it to a subscriber thread that
later found it displaced. Entries and every view over them now hold a
ForwarderRef: a caller that owns the forwarder pins it inline, and everyone else
posts to its executor. Entry cleanup keys off the entry's ForwarderId instead of
locking a weak_ptr, which used to decline to erase an entry exactly when its
forwarder was already gone, leaving an unfulfilled promise that every later
subscriber to that track waited on forever. The local-forwarder fan-out now
carries a track name and executor and resolves the publisher forwarder on that
executor at the point of use, so a subscriber whose hop lands late fails with
"publisher forwarder gone" rather than attaching to a forwarder nobody feeds.
@afrind
afrind force-pushed the relay/registry-forwarder-ref branch from 5a571e8 to ba64a2a Compare August 14, 2026 00:19
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.

2 participants