-
Notifications
You must be signed in to change notification settings - Fork 166
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
Return service from node_type_description_service_init #1112
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This makes the caller responsible for cleaning up the service. Signed-off-by: Michael Carroll <[email protected]>
mjcarroll
force-pushed
the
mjcarroll/fini_service
branch
from
October 26, 2023 21:13
54a4d99
to
43dfecc
Compare
Signed-off-by: Michael Carroll <[email protected]>
mjcarroll
changed the title
Make the fini of the type description service explicit
Return service from node_type_description_service_init
Oct 27, 2023
mjcarroll
commented
Oct 27, 2023
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
This was referenced Oct 28, 2023
fujitatomoya
approved these changes
Oct 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This was referenced Oct 30, 2023
clalancette
added a commit
that referenced
this pull request
Jun 25, 2024
In particular, make sure to match all service_description_init with the appropriate finis. While we are in here, also add in a "service_not_exists" function that will quit much earlier, speeding up the test. This is essentially a backport of #1107 and parts of #1112, but adapted for Iron. Signed-off-by: Chris Lalancette <[email protected]>
clalancette
added a commit
that referenced
this pull request
Jun 25, 2024
In particular, make sure to match all service_description_init with the appropriate finis. While we are in here, also add in a "service_not_exists" function that will quit much earlier, speeding up the test. This is essentially a backport of #1107 and parts of #1112, but adapted for Iron. Signed-off-by: Chris Lalancette <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the mechanism of
rcl_node_type_description_service_init
to populate a user-provided service.This makes it the calling user's responsibility to call
rcl_service_fini
on the returned service, making it more in line with the rest of thercl
API.This was discovered when working with the new
rclcpp::WaitSet
implementation.The main issue is that the executor needs to share ownership with objects that it is
wait
-ing on for the entire duration of thewait
, even if a node is removed from the executor at that time. That is, the executor doesn't have knowledge of the nodes so much as the waitable objects in the collection.In this current implementation, the type_description was being
fini
-ed during theNodeTypeDescriptions
destructor here: https://github.com/ros2/rclcpp/blob/fcbe64cff4bea3109531254ceb2955dc4b1bb320/rclcpp/src/rclcpp/node_interfaces/node_type_descriptions.cpp#L128-L139. This could cause a situation where a service is cleaned up while we are still waiting on it, and yields a segfault afterwards.After discussion with @clalancette, it seems the better approach is to have the user init the service and then be responsible for managing the lifetime of that service through their client library (eg
rclcpp::Service
)