ros2 / rmw_cyclonedds

ROS 2 RMW layer for Eclipse Cyclone DDS
Apache License 2.0
112 stars 91 forks source link

Crash on Ubuntu 22.04 #391

Closed KeplerC closed 2 years ago

KeplerC commented 2 years ago

Bug report

Required Info:

Steps to reproduce issue

Minimally working dockerfile:

ARG DISTRO=rolling
FROM ros:$DISTRO
ARG DISTRO
RUN apt update && apt install -y curl gnupg2 lsb-release && \
    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt install -y ros-rolling-desktop ros-rolling-rmw-cyclonedds-cpp

ENTRYPOINT [ "/ros_entrypoint.sh" ]
CMD ["bash"]

and run

$  . /opt/ros/rolling/setup.bash
$ export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
$ ros2 run demo_nodes_cpp talker
# or 
$ ros2 run demo_nodes_cpp listener

Expected behavior

listener and talker communicate with each other.

Actual behavior

$ ros2 run demo_nodes_cpp talker
$ ros2 run demo_nodes_cpp listener
[ERROR] [1651185922.565368862] [rclcpp]: executor taking a loaned message from topic '/parameter_events' unexpectedly failed: Loaning is not supported, at ./src/rmw_node.cpp:3345, at ./src/rcl/subscription.c:335
[ERROR] [1651185922.565616782] [rclcpp]: executor taking a loaned message from topic '/parameter_events' unexpectedly failed: Loaning is not supported, at ./src/rmw_node.cpp:3345, at ./src/rcl/subscription.c:335
[ERROR] [1651185922.565662817] [rclcpp]: executor taking a loaned message from topic '/parameter_events' unexpectedly failed: Loaning is not supported, at ./src/rmw_node.cpp:3345, at ./src/rcl/subscription.c:335

or sometimes they end up with segmentation fault or stack smashing. image

KeplerC commented 2 years ago

If unset RMW_IMPLEMENTATION=rmw_cyclonedds_cpp, the talker and listener example works perfectly.

This problem is similar to #390. However, it works fine with 20.04 in my case, so I am wondering if this is the problem with Ubuntu 22.04

clalancette commented 2 years ago

Hm, this is interesting, because I have the same version of rmw_cyclonedds_cpp installed, and I can run the examples just fine.

The error about "Loaning not supported" suggests to me that something weird is going on. Do you happen to have any environment variables about LOAN enabled? Or otherwise have some CycloneDDS configuration in use?

KeplerC commented 2 years ago

Hi Thanks for the clarification. I tried to further debug my own code and found the issue: The cyclonedds retrieved by apt-get is not compatible with the ros:rolling docker image. In my dockerfile, I did not put apt update before apt get, and the cyclone is retrieved from an incompatible build. This problem is resolved by changing image ros:rolling to ubuntu:jammy.

I am not 100% certain why this happens. I am closing this issue since the problem is solved, and I am happy to reopen if further investigation is neede.d