Skip to content

Make mux the source of truth for virtual channel prefix layout#63

Merged
dallison merged 2 commits intomainfrom
mux_checksums
Apr 30, 2026
Merged

Make mux the source of truth for virtual channel prefix layout#63
dallison merged 2 commits intomainfrom
mux_checksums

Conversation

@dallison
Copy link
Copy Markdown
Owner

VirtualChannel already forwards SlotSize/NumSlots/GetFds to its mux because storage is owned by the mux, but it did not forward ChecksumSize, MetadataSize, or PrefixSize. As a result, HandleCreatePublisher's SetChecksumSize/ SetMetadataSize/SetPrefixSize calls landed on the virtual channel only, the consistency check at the same site validated against per-vchan fields, and HandleCreateSubscriber returned the virtual channel's (often default) sizes. Two virtual channels on the same mux could silently disagree on prefix layout while sharing storage.

Mark the cs/ms/ps accessors and setters virtual on Channel and override them on VirtualChannel to delegate to the mux. Now the existing consistency check naturally rejects mismatched layouts across vchans on a mux, subscribers always receive the mux's authoritative sizes, and writes from any vchan handle update the shared mux.

Made-with: Cursor

Dave Allison added 2 commits April 29, 2026 18:04
VirtualChannel already forwards SlotSize/NumSlots/GetFds to its mux because
storage is owned by the mux, but it did not forward ChecksumSize, MetadataSize,
or PrefixSize. As a result, HandleCreatePublisher's SetChecksumSize/
SetMetadataSize/SetPrefixSize calls landed on the virtual channel only, the
consistency check at the same site validated against per-vchan fields, and
HandleCreateSubscriber returned the virtual channel's (often default) sizes.
Two virtual channels on the same mux could silently disagree on prefix layout
while sharing storage.

Mark the cs/ms/ps accessors and setters virtual on Channel and override them
on VirtualChannel to delegate to the mux. Now the existing consistency check
naturally rejects mismatched layouts across vchans on a mux, subscribers
always receive the mux's authoritative sizes, and writes from any vchan
handle update the shared mux.

Made-with: Cursor
VirtualChannelMuxPrefixIsShared verifies that a publisher's checksum_size
and metadata_size on one virtual channel propagate to the mux, that a
subscriber on a sibling vchan sees those sizes (not the per-vchan defaults),
that a matching second publisher on a sibling vchan succeeds, and that
mismatched cs/ms on another sibling vchan is rejected.

VirtualChannelMuxPrefixSubscriberFirst covers the placeholder-mux path:
a subscriber creates the mux and a vchan first, then a publisher with
non-default cs/ms arrives, and a subsequent subscriber on a sibling vchan
sees the publisher's authoritative sizes via the mux.

Both tests fail on the previous code (sibling vchans report PrefixSize=64
default) and pass after the layout-forwarding fix.

Made-with: Cursor
@dallison dallison merged commit f10bdfb into main Apr 30, 2026
6 checks passed
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