Skip to content

C++ SHM is removed when any writer exits #586

Description

@avinxshKD

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:

  1. Use {"876543": 1} in concore.oport.
  2. Start writer A and keep it running.
  3. Start writer B with the same config, then let it exit.
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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