Bug report
Required Info:
- Operating System:
- ROS2 Version:
- Version or commit hash:
- DDS implementation:
Steps to reproduce issue
Actually It's similar to this issue #1961
Expected behavior
always accept goals
Actual behavior
the server will not accept goals when the deadlock happens
Additional information
backtrace
deadlock
- std::lock_guard<std::mutex> lock(goal_handles_mutex_);
- std::lock_guard<std::recursive_mutex> lock(update_mutex_);
- Thread 3612: working thread
- std::lock_guard<std::recursive_mutex> lock(update_mutex_);
- std::lock_guard<std::mutex> lock(goal_handles_mutex_);
The lock sequences are different.
But if I commented the code std::lock_guard<std::recursive_mutex> lock(update_mutex_);, it would cause this rclcpp issue ros2/rclcpp#1599
So if using another mutex or some atomic variables to mark the action state. I think it could be solved.
- If it is publishing succeeded state, so reject the cancel request. It returns succeeded state.
- If it is canceling, so abort publishing succeeded state. It returns canceled state.
Bug report
Required Info:
Steps to reproduce issue
Actually It's similar to this issue #1961
Expected behavior
always accept goals
Actual behavior
the server will not accept goals when the deadlock happens
Additional information
backtrace
Thread 9: main thread
Frame# 6 nav2_util::SimpleActionServer<nav2_msgs::action::ComputePathToPose, rclcpp::Node>::handle_cancel
Frame# 13 rclcpp_action::Server<nav2_msgs::action::ComputePathToPose>::call_handle_cancel_callback
Thread 3612: working thread
Frame# 5 rclcpp_action::Server<nav2_msgs::action::ComputePathToPose>::call_goal_accepted_callback
Frame# 9 rclcpp_action::ServerGoalHandle<nav2_msgs::action::ComputePathToPose>::succeed
deadlock
The lock sequences are different.
But if I commented the code std::lock_guard<std::recursive_mutex> lock(update_mutex_);, it would cause this rclcpp issue ros2/rclcpp#1599
So if using another mutex or some atomic variables to mark the action state. I think it could be solved.