ros2 communication_error ai_generated true

[RTPS_TRANSPORT_SHM] Failed to create shared memory segment

ID: ros2/fastdds-shared-memory-error

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

Fast DDS shared memory transport fails. Common in Docker containers or when /dev/shm is too small.

generic

Workarounds

  1. 92% success Increase Docker --shm-size if running in containers
    docker run --shm-size=512m ... or add shm_size: 512m in docker-compose
  2. 88% success Disable SHM transport via Fast DDS XML profile
    Export FASTRTPS_DEFAULT_PROFILES_FILE=no_shm.xml with <transport_descriptor><type>UDPv4</type></transport_descriptor>
  3. 82% success Set RMW_FASTRTPS_USE_QOS_FROM_XML=1 for full control over transport

Dead Ends

Common approaches that don't work:

  1. Disable Fast DDS entirely and switch RMW 75% fail

    The fix is simpler: just configure SHM correctly or disable only the SHM transport

  2. Increase system shared memory to very large values 70% fail

    If running in Docker, the host /dev/shm size is what matters, not sysctl settings