Open haudren-woven opened 2 years ago
@haudren-woven
It works well on ros:rolling with latest rclcpp.
I agree that this is a bug, however I don't agree with your recommendation
Since I think it's undesirable to throw in the destructor, I would recommend to catch exceptions and log since not being able to notify the terminal state is a non-issue when destroying goal handles.
Logging an error and continuing with the shut down will leave the action client waiting forever for a goal result. The action server should be notified when "shutdown" is occurring and, before that, it should be allowed to have time to abort the goal.
Logging an error and continuing with the shut down will leave the action client waiting forever for a goal result. The action server should be notified when "shutdown" is occurring and, before that, it should be allowed to have time to abort the goal.
Yes I think that's the best way to do it, and that's pretty much what I ended up doing by manually registering shutdown callbacks to destroy the ActionServer before the shutdown is complete.
However, in the current situation, I don't see how it would be an issue to ignore the exception: we already can't terminate the goal handle correctly, so the client will hang forever anyways. We might as well catch the exception and prevent abnormal termination.
Bug report
Required Info:
Steps to reproduce issue
rclcpp::spin(node)
(Note : I can write a complete example code, but it's a lot of boilerplate to set up an action server...)
Expected behavior
The node shutdowns cleanly
Actual behavior
An exception is thrown in the destructor:
on_terminal_state
on_terminal_state
callsnotify_goal_terminal_state
rclcpp
has already been shutdown,notify_goal_terminal_state
will throw hereAdditional information
Since I think it's undesirable to throw in the destructor, I would recommend to catch exceptions and log since not being able to notify the terminal state is a non-issue when destroying goal handles.
If storing GoalHandle is an undesired behavior, I wonder if there is any way to prevent the user from doing so?
Finally, the bug only appears if we destroy the goal handle before the action server. So this issue can be mitigated by managing manually the destruction ordering.