Skip to content

Commit e9d98dd

Browse files
cboostjvisserRBT22
authored andcommitted
Fix lifecycle manager deadlock during shutdown (ros-navigation#5448)
Signed-off-by: Jacob Visser <jacob.visser@cboost.nl>
1 parent 2a4c71e commit e9d98dd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

nav2_util/include/nav2_util/lifecycle_service_client.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class LifecycleServiceClient
3636
const std::string & lifecycle_node_name,
3737
rclcpp::Node::SharedPtr parent_node);
3838

39+
~LifecycleServiceClient()
40+
{
41+
change_state_.stop();
42+
get_state_.stop();
43+
}
44+
3945
/// Trigger a state change
4046
/**
4147
* Throws std::runtime_error on failure

nav2_util/include/nav2_util/service_client.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ class ServiceClient
145145
return service_name_;
146146
}
147147

148+
/**
149+
* @brief Stop any running spin operations on the internal executor
150+
*/
151+
void stop()
152+
{
153+
if (client_) {
154+
callback_group_executor_.cancel();
155+
}
156+
}
157+
148158
protected:
149159
std::string service_name_;
150160
NodeT node_;

0 commit comments

Comments
 (0)