Skip to content

IPC hub: connector re-register left bound to closed ring if ShmRingBuffer reopen fails #209

Description

@nvddr

Summary

In HubEndpoint._handle_registration, if a connector re-registers and the new ShmRingBuffer(name=reg.shm_name, create=False) reopen raises, self._ring_registry[reg.connector_id] is never reassigned and keeps pointing at the just-closed old_ring. That connector then fails every subsequent FRAME_SIGNAL (read_slot on a released buffer, caught by _dispatch) and never recovers — a stuck, stale-closed registry entry.

Context

Surfaced during review of #202 (which fixed the use-after-close / BufferError by releasing exported SlotView memoryviews before old_ring.close()). That fix is correct; this is a separate, pre-existing edge case noted for follow-up — out of scope for #202.

Post-#202 the failure mode degrades from #197-style corruption to a caught error, but the connector is still permanently broken until it re-registers again, because the registry entry points at a closed ring.

Location

server-runtime/xr_media_hub/ipc/_hub.py_handle_registration, around the ShmRingBuffer(..., create=False) reopen (~L348).

Suggested fix

On reopen failure, pop the stale _ring_registry[reg.connector_id] entry (and any related per-connector state) so the connector isn't left bound to a closed ring — or reopen into a local first and only swap into the registry once construction succeeds.

Severity

Low — requires a reopen failure during connector re-registration (crash/reconnect path). No data corruption (caught), but the affected connector is stuck until it registers anew.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions