-
Notifications
You must be signed in to change notification settings - Fork 224
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
Thread safe node.destroy_* #319
Conversation
7ba0972
to
0e8cda0
Compare
I think I have to include # In another thread an executor is spinning
# srv destruction delayed because executor is waiting on service
node.destroy_service(srv)
# node is destroyed instantly; service still not destroyed because it's being used by executor
node.destroy_node()
# When executor shuts down the service is no longer being used, so it's destroyed
# since the node was destroyed first the service will segfault in rmw_fastrtps
executor.shutdown() I'm thinking of chaining handles so that |
c6e3e8c
to
3ac25ce
Compare
3ac25ce
to
5bea9ba
Compare
Publisher now uses Handle pub.publisher_handle -> pub.handle Added test for publisher destruction Added rclpy_publisher_t to replace rcl_publisher_t Signed-off-by: Shane Loretz<sloretz@openrobotics.org> Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Client now uses Handle Client.client_handle and client_pointer replaced by client.handle rclpy_destroy_entity no longer destroy's clients Added test for client destruction Client capsule uses rclpy_client_t instead of rcl_client_t Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
052b0ed
to
e4ca965
Compare
self._guard_condition = gc | ||
self._guard_condition_handle = gc_handle | ||
self._guard = GuardCondition( | ||
callback=None, callback_group=None, context=self._context) |
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.
Reusing GuardCondition
to reuse executor code that uses guard_condition.handle
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
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.
Partial review with some feedback on parts I know :). Will do some additional review after.
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
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.
All right, a few more review comments, mostly phrased as questions as I'm still getting a handle on how this works (pun intended).
rclpy/rclpy/node.py
Outdated
return True | ||
if publisher in self.publishers: | ||
self.publishers.remove(publisher) | ||
publisher.destroy() |
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.
For all of these destroy calls, do we need to check for the InvalidHandle
exception? Is that a case that can happen?
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.
It is. Maybe this should catch it and return False
?
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.
Yeah, that seems reasonable.
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.
destroy_<entity>()
catch InvalidHandle
and return False
in e630404
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
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.
The code looks good to me now, so I'll approve.
My only remaining question is whether we should open an issue for reducing the complexity here by introducing rmw_shutdown_but_not_fini
for a future enhancement. Thoughts on that?
I've gone back and forth between writing the issue on |
Follow up to #318 and #330. This PR applies the changes done to
Subscription
to the rest of the entities on the node so they can all be destroyed safely.Not done in this PR. These might require a change to the waitable API.