Skip to content

SHM create race: attachers mmap a size-0 segment ("cannot mmap an empty file") #3671

Description

@mustafab0

Symptom: consumers crash attaching to a SHM segment with ValueError: cannot mmap an empty file (seen on real runs, July sprint).

Race: stdlib SharedMemory(create=True, size=N) does shm_open then ftruncate. An attacher that opens in that window sees size 0 and mmaps nothing. _open_shm_with_retry (ipc_factory.py:49) only catches FileNotFoundError, so it never covered this. Affected paths are the name-derived symmetric ones: _create_or_open (:145) attach arm, plus direct SharedMemory(create=True, ...) sites (~:174).

Fix: explicit readiness, readers now wait until the segment actually has a size, with a 10s cap and a clear error if it never shows up. No sleep ladder, no blind retries.

Blast radius: shared transport infra — all robots, sim modules, cameras, every SHM pubsub user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions