Skip to content

relay: answer trackStatus without touching registry forwarder in LF mode#451

Merged
afrind merged 1 commit into
mainfrom
fix/mt-track-status
Jun 26, 2026
Merged

relay: answer trackStatus without touching registry forwarder in LF mode#451
afrind merged 1 commit into
mainfrom
fix/mt-track-status

Conversation

@afrind

@afrind afrind commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

In LF mode the registry's forwarder lives on the publisher exec, so reading its largest/groupOrder/numForwardingSubscribers from relayExec_ (or the requesting session exec) in trackStatusImpl was an unsynchronized cross-thread read of non-atomic fields.

Resolve trackStatus against thread-local forwarders instead. LocalSubscribeFilter gains a trackStatus override that answers from the requester's local forwarder on the subscriber exec (zero hops). When the requester isn't subscribed, trackStatusImpl hops to the publisher exec and reads the publisher forwarder via tlForwarders_ by FTN, only falling through to upstream when the relay has no forwarding subscription. Non-LF modes still read the registry forwarder inline; relayExec_ owns the sole forwarder there.


This change is Reviewable

In LF mode the registry's forwarder lives on the publisher exec, so reading
its largest/groupOrder/numForwardingSubscribers from relayExec_ (or the
requesting session exec) in trackStatusImpl was an unsynchronized cross-thread
read of non-atomic fields.

Resolve trackStatus against thread-local forwarders instead. LocalSubscribeFilter
gains a trackStatus override that answers from the requester's local forwarder on
the subscriber exec (zero hops). When the requester isn't subscribed, trackStatusImpl
hops to the publisher exec and reads the publisher forwarder via tlForwarders_ by FTN,
only falling through to upstream when the relay has no forwarding subscription. Non-LF
modes still read the registry forwarder inline; relayExec_ owns the sole forwarder there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@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 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on afrind).

@afrind afrind merged commit 1d03d1c into main Jun 26, 2026
16 checks passed
@afrind afrind deleted the fix/mt-track-status branch June 26, 2026 21:59
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