dimensionalOS / dimensionalOS/dimos
SHM create race: attachers mmap a size-0 segment ("cannot mmap an empty file")
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.5k
- Forks
- 808
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 233
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in dimos/protocol/pubsub/shm/ipc_factory.py at _open_shm_with_retry and _create_or_open, then inspect the direct SharedMemory(create=True, ...) sites around line 174. Verify that attachers wait for a nonzero segment size with a 10-second cap and produce a clear error if readiness never appears, without blind retries or a sleep ladder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100