Fast-DDS: [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7415: open_and_lock_file failed -> Function open_port_internal [13645]
The error above appears when launching a FastDDS 2.3.1 application generated from FastRTPSGen and also when using ROS2 nodes, with rmw_fastrtps_cpp
as the RMW, in ROS2 Galactic with ROS_LOCALHOST_ONLY
set. To note that the same behavior doesn’t happen using ROS2 Foxy (i.e. FastDDS 2.0.2) in the same platform.
Expected Behavior
The following error should not appear and one should be able to use the Shared Memory transport.
Current Behavior
The error appears and one is unable to use the SharedMemory transport.
Steps to Reproduce
It seems to be platform specific, as I don’t see this in my laptop. But the error description should provide enough context to what might be the problem and maybe you can provide a possible solution. Note that in the FastDDS app the following code (specific to whitelisting the localhost and use the Shared Memory transport) is run for both publishers and subscribers:
// Create a custom network UDPv4 transport descriptor
// to whitelist the localhost
auto localhostUdpTransport = std::make_shared<UDPv4TransportDescriptor>();
localhostUdpTransport->interfaceWhiteList.emplace_back("127.0.0.1");
// Disable the built-in Transport Layer
PParam.rtps.useBuiltinTransports = false;
// Add the descriptor as a custom user transport
PParam.rtps.userTransports.push_back(localhostUdpTransport);
// Add shared memory transport when available
auto shmTransport = std::make_shared<SharedMemTransportDescriptor>();
PParam.rtps.userTransports.push_back(shmTransport);
System information
The platform is an Ubuntu 20.04 container in an arm64
/aarch64
SOM with Linux kernel based from 4.14.98.
- Fast-RTPS version: 2.3.1
- OS: Ubuntu 20.04
- Network interfaces: lo (127.0.0.1)
- ROS2: Galactic
Additional context
Additional resources
- Wireshark capture: This is running on a SOM in the lo, so I am not entirely sure how I can capture there.
- XML profiles file: N.A.
Thanks in advance for the help! @MiguelCompany @Dani-Cabezas
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (10 by maintainers)
This error is shown when some shared memory files have not been correctly freed if the Fast DDS application has crashed or has not been closed cleanly. Fast DDS CLI provides an option to clean zombie files:
fastdds shm clean
. The issue is that if the file is still blocked because Fast DDS was closed unexpectedly then this tool cannot remove the file. Then, the only option is to remove these files manually. The shared memory files are saved in the following folders and are named withfastrtps
included in their filenames:/dev/shm/
/private/tmp/boost_interprocess/
C:\programdata\eprosima\fastrtps_interprocess\
I am getting the same error in the official Docker container of ROS2 Foxy distribution.
2021-06-09 10:56:04.734 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7435: open_and_lock_file failed -> Function open_port_internal
It appears when I try to publish a message on a topic within the docker container.
I have created a ticket labelled as enhancement to improve the SHM Transport logged messages in order to make them more helpful to the user (#3578). I am going to close this issue as the cause for the log message has been explained. The other issue mentioned in the latest comments is being tracked in its own ticket (#2811). Finally, the Fast DDS version is no longer maintained.
I’ve met this problem in ROS2 Foxy, which is fastdds2.0.3.
@duchengyao I would suggest running
fastdds shm clean
first. It will inform of the number of removed segments, as well as the ones still in use. For instance:If the reported number of cleaned ports and segments is 0, you could then try to remove all files on the shared folder. The operating system will only let you remove the ones created by the process that crashed, since the other ones will have an exclusive lock in place.