ros2 / rmw_fastrtps

Implementation of the ROS Middleware (rmw) Interface using eProsima's Fast RTPS.
Apache License 2.0
157 stars 117 forks source link

Add in a missing data_reader check when creating subscription. #697

Closed clalancette closed 1 year ago

clalancette commented 1 year ago

The end stanza of create_datareader() is supposed to be attempting to create a datareader with the underlying Fast-DDS library. If creation of the datareader returns a valid pointer, we've succeeded, and if it returns a nullptr, it has failed.

However, there were two separate problems of the logic checking for these conditions:

  1. It was checking the datareader pointer-to-a-pointer, which should always be non-null. What it really meant to check was the datareader pointer (dereferenced).
  2. There is a fallback mechanism for when unique network flow endpoints were optionally required. The problem with that is that when using the fallback, we never check again to make sure the fallback was successful. Therefore, if we failed for another reason (like security), we would not discover it until a crash later on.

This commit fixes both of these issues.

This commit will improve the error reporting as in https://github.com/ros2/sros2/issues/287 , though it does not completely solve it (I think we need more work at the rclcpp layer).

clalancette commented 1 year ago

CI: