Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Ensure compliant matched pub/sub count API. #451

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Aug 20, 2020

Connected to ros2/rmw#262.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Comment on lines -347 to -354
if (!info) {
RMW_SET_ERROR_MSG("publisher internal data is invalid");
return RMW_RET_ERROR;
}
if (!info->listener_) {
RMW_SET_ERROR_MSG("publisher internal listener is invalid");
return RMW_RET_ERROR;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing these checks?

(sorry if this is redundant with what we have talked about before)

Copy link
Contributor Author

@hidmic hidmic Aug 20, 2020

Choose a reason for hiding this comment

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

See ros2/rmw_fastrtps#408 (comment). I can't find the discussion about not duplicating checks across rmw_fastrtps_shared_cpp and the actual Fast-RTPS based RMW implementation.

But long story short:

  • There's no point in checking arguments for nullity twice -- once in rmw_fastrtps(_dynamic)_cpp, once in rmw_fastrtps_shared_cpp.
  • There's no point in guarding ourselves against those particular UB cases. If an rmw_fastrtps(_dynamic)_cpp publisher (or subscription) has nullptr internals (or FWIW, any non-valid pointers), then (a) the user is using the structure in an unintended way (and the program is logically incorrect), (b) the implementation is logically incorrect, or (c) memory corruption ensued.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, thanks for that discussion. Sorry, long day yesterday :).

Comment on lines -347 to -354
if (!info) {
RMW_SET_ERROR_MSG("publisher internal data is invalid");
return RMW_RET_ERROR;
}
if (!info->listener_) {
RMW_SET_ERROR_MSG("publisher internal listener is invalid");
return RMW_RET_ERROR;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, thanks for that discussion. Sorry, long day yesterday :).

@hidmic
Copy link
Contributor Author

hidmic commented Aug 26, 2020

CI up to test_rmw_implementation, against all Tier 1 RMW implementations:

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

@hidmic hidmic merged commit 7bb1739 into master Aug 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/ensure-compliant-pub-sub-count branch August 27, 2020 15:55
ahcorde pushed a commit that referenced this pull request Oct 8, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 15, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants