The C++ SHM cleanup assumes every Concore instance owns the shared segment.
With two writers using the same SHM key, destroying either writer calls IPC_RMID for both the segment and semaphore. The other writer is still alive, but new readers can no longer attach and the remaining writers lose their lock.
createSharedMemory() also resets the header and payload when it attaches to an existing segment.
Repro:
- Use {"876543": 1} in concore.oport.
- Start writer A and keep it running.
- Start writer B with the same config, then let it exit.
- Run ipcs -m | grep 000d5fff.
The segment exists before B exits and disappears afterwards, even though A is still running.
Expected: the segment should stay available while another process is using it.
Actual: any writer can remove the shared resources for every other writer.
This is in both concore.hpp and concoredocker.hpp.
The C++ SHM cleanup assumes every
Concoreinstance owns the shared segment.With two writers using the same SHM key, destroying either writer calls IPC_RMID for both the segment and semaphore. The other writer is still alive, but new readers can no longer attach and the remaining writers lose their lock.
createSharedMemory() also resets the header and payload when it attaches to an existing segment.
Repro:
The segment exists before B exits and disappears afterwards, even though A is still running.
Expected: the segment should stay available while another process is using it.
Actual: any writer can remove the shared resources for every other writer.
This is in both concore.hpp and concoredocker.hpp.