ros2 / rmw_iceoryx

rmw implementation for iceoryx
Apache License 2.0
144 stars 27 forks source link

[Foxy]`ros2 topic echo/hz ` causes segment fault. #49

Open ZhenshengLee opened 3 years ago

ZhenshengLee commented 3 years ago

Env

Observed

zs@zs-3630:~$ ros2 topic echo /tf
2021-07-06 10:39:44.892 [ Debug ]: Application registered management segment 0x7fe178bad000 with size 60126248 to id 1
2021-07-06 10:39:44.893 [ Debug ]: Application registered payload data segment 0x7fe16fcd0000 with size 149264720 to id 2
Segmentation fault (core dumped)

Expected

ros2 topic echo /tf run without error

Comment

the following commands also cause segfault.

lgsvl may not be needed to reproduce the behavior.

_Originally posted by @ZhenshengLee in https://github.com/ros2/rmw_iceoryx/issues/42#issuecomment-874418462_

christophebedard commented 2 years ago

@ZhenshengLee were you able to check whether this works? https://answers.ros.org/question/384441/how-to-debug-rmw-segfaults-launched-by-ros2cli-like-ros2-topic-echo/?answer=384845#post-id-384845

mossmaurice commented 2 years ago

@ZhenshengLee Can you double check if this problem in your setup is fixed or persists after #70 has been merged? Thanks!

ZhenshengLee commented 2 years ago

@mossmaurice

@ZhenshengLee Can you double check if this problem in your setup is fixed or persists after #70 has been merged? Thanks!

I am happy to do so, but #70 is for #57 and #69 , especially in galactic branch. Seeing your changes in https://github.com/ros2/rmw_iceoryx/blob/4b2ebbdcec913a08cfe45fc045e5de0e5bdbc812/rmw_iceoryx_cpp/src/internal/iceoryx_type_info_introspection.cpp#L212

There is nothing wrong in the foxy branch of this function, see https://github.com/ros2/rmw_iceoryx/blob/676a6de1c4b7f9ff0d99a3521942db4ac3d4de2d/rmw_iceoryx_cpp/src/internal/iceoryx_type_info_introspection.cpp#L182

This issue was created when ros2 topic echo /chatter work but ros2 topic echo /tf makes segfault.

I will give it a test in foxy branch with @christophebedard method, but it will not be a double-check.

ZhenshengLee commented 2 years ago

@mossmaurice

Edit:

A fast way to reproduce this bug it to

ros2 launch velodyne_description example.launch.py
ros2 topic echo /tf_static

And you will see

Log level set to: [Warning]
Segmentation fault (core dumped)
ZhenshengLee commented 2 years ago

@christophebedard your method works on vscode! Thank you very much.

the launch file in vscode is like the following.

{
            "name": "zs: gdbrun ros2",
            "type": "cppdbg",
            "request": "launch",
            "program": "/usr/bin/python3",
            "args": [
                "/opt/ros/foxy/bin/ros2",
                "topic",
                "echo",
                "/tf_static"
            ],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [
                {
                    "name": "RMW_IMPLEMENTATION",
                    // "value": "rmw_fastrtps_cpp"
                    // "value": "rmw_ecal_proto_cpp"
                    "value": "rmw_iceoryx_cpp"
                }
            ],
            "externalConsole": false,
            // "preLaunchTask": "source_ros2_ws",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },