[22647] Shared Memory Object Deleted When Calling system() in QNX Environment
Is there an already existing issue for this?
- [X] I have searched the existing issues
Expected behavior
Calling the system() function within a FastDDS-based application running on a QNX environment should execute the desired system command without interfering with FastDDS's internal mechanisms. Specifically, invoking system() should not result in the deletion or corruption of FastDDS shared memory objects.
Current behavior
When the system() function is invoked within a FastDDS-based application on a QNX environment, it unexpectedly leads to the deletion of a FastDDS shared memory object. This results in the failure of DDS operations, such as the inability of subscribers to receive published data.
The issue persists even when using native FastDDS examples(Fast-DDS-2.12.2/examples/cpp/dds/HelloWorldExampleSharedMem) with minimal modifications。
Steps to reproduce
-
Operating System: QNX localhost 7.1.0S aarch64le
-
FastDDS Version: 2.12.2
-
Modify the (Fast-DDS-2.12.2/examples/cpp/dds/HelloWorldExampleSharedMem/HelloWorldPublisher.cpp)Code:
-
Compile
-
Run the examples publisher :
./examples/cpp/dds/HelloWorldExampleSharedMem/bin/DDSHelloWorldExampleSharedMem publisher 100 1000 -
Observe the Behavior : From the output logs, it can be seen that after the publisher has executed several cycles, a fastrtps_xxxxx shared memory object in /dev/shmem/ disappears.
Fast DDS version/commit
v2.12.2
Platform/Architecture
Other. Please specify in Additional context section.
Transport layer
Default configuration, UDPv4 & SHM
Additional context
No response
XML configuration file
No response
Relevant log output
Below are the logs captured during the issue reproduction:
[2025-01-14 16:51:38] Publisher running 100 samples.
[2025-01-14 16:51:38] total 4411
[2025-01-14 16:51:39] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:39] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:39] nrw-r--r-- 2 root root 2122272 Jan 02 14:08 fastrtps_22ca76eb240aff92
[2025-01-14 16:51:39] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:39] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:39] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:39] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:39] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:39] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:39] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:39] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:39] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:39] total 4411
[2025-01-14 16:51:40] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:40] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:40] nrw-r--r-- 2 root root 2122272 Jan 02 14:08 fastrtps_22ca76eb240aff92
[2025-01-14 16:51:40] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:40] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:40] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:40] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:40] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:40] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:40] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:40] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:40] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:40] total 4411
[2025-01-14 16:51:41] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:41] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:41] nrw-r--r-- 2 root root 2122272 Jan 02 14:08 fastrtps_22ca76eb240aff92
[2025-01-14 16:51:41] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:41] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:41] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:41] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:41] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:41] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:41] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:41] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:41] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:41] total 4411
[2025-01-14 16:51:42] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:42] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:42] nrw-r--r-- 2 root root 2122272 Jan 02 14:08 fastrtps_22ca76eb240aff92
[2025-01-14 16:51:42] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:42] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:42] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:42] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:42] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:42] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:42] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:42] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:42] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:42] total 4411
[2025-01-14 16:51:43] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:43] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:43] nrw-r--r-- 2 root root 2122272 Jan 02 14:08 fastrtps_22ca76eb240aff92
[2025-01-14 16:51:43] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:43] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:43] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:43] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:43] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:43] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:43] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:43] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:43] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:43] total 265
[2025-01-14 16:51:44] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:44] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:44] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:44] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:44] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:44] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:44] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:44] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:44] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:44] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:44] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:44] total 265
[2025-01-14 16:51:45] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:45] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:45] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:45] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:45] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:45] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:45] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:45] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:45] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:45] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:45] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:45] total 265
[2025-01-14 16:51:46] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:46] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:46] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:46] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:46] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:46] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:46] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:46] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:46] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:46] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:46] CMD : ls -l /dev/shmem ret:0
[2025-01-14 16:51:46] total 265
[2025-01-14 16:51:47] -rw-rw-r-- 2 root root 83 Jan 01 08:00 analyzer_startup_log.txt
[2025-01-14 16:51:47] -rw-rw-rw- 2 root root 860 Jan 01 08:00 clockdebug_log
[2025-01-14 16:51:47] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7400
[2025-01-14 16:51:47] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7410
[2025-01-14 16:51:47] nrw-r--r-- 2 root root 40048 Jan 02 14:08 fastrtps_port7411
[2025-01-14 16:51:47] -rw-rw-r-- 2 root root 949 Jan 01 08:00 graphics.conf
[2025-01-14 16:51:47] -rw-r--r-- 3 root root 1180 Jan 01 08:00 initial_DSP_logs.qmdl
[2025-01-14 16:51:47] -rw-rw-r-- 2 root root 635 Jan 01 08:00 logs.txt
[2025-01-14 16:51:47] dr-xr-xr-x 2 root root 0 Jan 02 14:08 slogger2
[2025-01-14 16:51:47] -rw-r--r-- 3 root root 9175 Jan 01 08:00 tracebuffer.kev
[2025-01-14 16:51:47] CMD : ls -l /dev/shmem ret:0
Network traffic capture
No response
Hi @hao47825148,
To start with, could you check trying to use fastdds 2.14.x?
I attempted testing with version 2.14.4 and encountered the same issue.
However, while compiling with the QNX toolchain, I found that QNX 7.1 does not support SCHED_BATCH and SCHED_IDLE. To address this, I made some modifications to src/cpp/utils/threading/threading_pthread.ipp (https://github.com/eProsima/Fast-DDS/blob/90bebe3f1c3a7c42d8345b8d6f05f9627453b4a9/src/cpp/utils/threading/threading_pthread.ipp#L98).
I believe this modification should not cause any issues since my system defaults to SCHED_RR.
@Javgilavi