Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

clalancette
Copy link
Contributor

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 ros2/sros2#287 , though it does not completely solve it (I think we need more work at the rclcpp layer).

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.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Copy link
Contributor

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clalancette Nice catch!

Copy link
Contributor

@iuhilnehc-ynos iuhilnehc-ynos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clalancette Thanks, it's my bad definitely.

@clalancette
Copy link
Contributor Author

clalancette commented Jul 18, 2023

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@clalancette clalancette merged commit efa94f7 into rolling Jul 19, 2023
3 checks passed
@clalancette clalancette deleted the clalancette/fix-invalid-data-reader-checking branch July 19, 2023 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants