Skip to content

fix(ipc): auto-claim shm client slots#24236

Merged
charlielye merged 1 commit into
nextfrom
cl/ipc-shm-auto-claim
Jun 23, 2026
Merged

fix(ipc): auto-claim shm client slots#24236
charlielye merged 1 commit into
nextfrom
cl/ipc-shm-auto-claim

Conversation

@charlielye

Copy link
Copy Markdown
Contributor

Summary

  • make MPSC SHM clients self-allocate a free producer slot when no explicit client id is provided
  • pass omitted TS/NAPI client ids through to the native auto-claim path instead of defaulting to slot 0
  • add C++ and world-state regression tests for multi-client SHM response correlation and clean slot reuse

Why

Multiple SHM clients were defaulting to producer slot 0. In the wsdb/AVM topology that means separate clients can share one request/response ring pair and steal or mis-correlate responses. The fix adds a small owner table to the existing MPSC doorbell mapping so clients can atomically claim distinct slots.

This intentionally does not try to recover stale in-flight requests left by a crashed client. Clean disconnect releases the claimed slot for reuse.

Validation

  • cmake --build build --target ipc_runtime_tests -j
  • ./build/ipc_runtime_tests --gtest_filter='ShmTest.MpscReactorMultiClientResponseRouting:ShmTest.MpscReactorAutoClaimMultiClient:ShmTest.MpscSlotFreedOnDisconnectAndReclaimed'

Note: the fresh next-based worktree had no yarn install state, so the TS world-state test is left for CI here. It passed earlier in the existing built ipc-5 worktree before this was split into a standalone PR.

@charlielye
charlielye merged commit 8beb60b into next Jun 23, 2026
20 checks passed
@charlielye
charlielye deleted the cl/ipc-shm-auto-claim branch June 23, 2026 15:36
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