Repository navigation
seg fault on emitWakeUpSignal call in the result_callback lamda function #115
Copy link
Copy link
Open
Description
Activity
Writing a clear description on the issue and how to reproduce it in this comment.
Issue
I have BT executor, and I start executing a tree with a just a sequence and ROS action client in this sequence. I cancel this goal, and the result request for cancel times out and when i start executing the tree again, the delayed result is now being processed and the result tries to wake up a already exited tree, resulting in a seq fault
To Reproduce
Steps to reproduce the issue using btcpp_ros2_samples pkg
- Add this sleep in line 68 to reproduce a delay in the result from the server
+ rclcpp::sleep_for(std::chrono::seconds(3));BehaviorTree.ROS2/btcpp_ros2_samples/src/sleep_server.cpp
Lines 67 to 73 in 7a6ace6
if(goal_handle->is_canceling()) { result->done = false; goal_handle->canceled(result); RCLCPP_INFO(this->get_logger(), "Goal canceled"); return; }
2. Use this behaviour tree :<root BTCPP_format="4"> <BehaviorTree ID="SleepActionSample2"> <Sequence> <SaySomething message="start"/> <SleepAction name="sleepA" action_name="sleep_service" msec="20000"/> <SaySomething message="sleep completed"/> </Sequence> </BehaviorTree> </root>- Build the package
- Run the sample_bt_executor that launches both the bt_executor and sleep server with
ros2 launch btcpp_ros2_samples sample_bt_executor.launch.xml- Start executing the tree:
ros2 action send_goal /behavior_server btcpp_ros2_interfaces/action/ExecuteTree "{target_tree: SleepActionSample2}"- Cancel the goal using:
ros2 service call /behavior_server/_action/cancel_goal action_msgs/srv/CancelGoal- Now do Step 5 again and it shoud crash
ENVIRONMENT:
- ROS Version humble
- BT.ROS2 branch - humble
Error Details from GDB Bt
Thread 35 "sample_bt_execu" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffd37ee640 (LWP 1081281)] 0x00007ffff7be7608 in BT::TreeNode::emitWakeUpSignal() () from /home/saravana/do cker22.04/ddiplus_ws/install/behaviortree_cpp/lib/libbehaviortree_cpp.so (gdb) bt #0 0x00007ffff7be7608 in BT::TreeNode::emitWakeUpSignal() () from /ws/install/behaviortree_cpp/lib/libbe haviortree_cpp.so #1 0x00007ffff03bd6f1 in BT::RosActionNode<btcpp_ros2_interfaces::action::Sleep >::tick()::{lambda(rclcpp_action::ClientGoalHandle<btcpp_ros2_interfaces::action ::Sleep>::WrappedResult const&)#3}::operator()(rclcpp_action::ClientGoalHandle<b tcpp_ros2_interfaces::action::Sleep>::WrappedResult const&) const () from /ws/install/btcpp_ros2_samples/share/b tcpp_ros2_samples/bt_plugins/libsleep_plugin.so #2 0x00007ffff03c9077 in void std::__invoke_impl<void, BT::RosActionNode<btcpp_ ros2_interfaces::action::Sleep>::tick()::{lambda(rclcpp_action::ClientGoalHandle <btcpp_ros2_interfaces::action::Sleep>::WrappedResult const&)#3}&, rclcpp_action ::ClientGoalHandle<btcpp_ros2_interfaces::action::Sleep>::WrappedResult const&>( std::__invoke_other, BT::RosActionNode<btcpp_ros2_interfaces::action::Sleep>::ti ck()::{lambda(rclcpp_action::ClientGoalHandle<btcpp_ros2_interfaces::action::Sle ep>::WrappedResult const&)#3}&, rclcpp_action::ClientGoalHandle<btcpp_ros2_inter faces::action::Sleep>::WrappedResult const&) ()
Metadata
Metadata
Assignees
Labels
No labels
I have a TreeExecutor and on execution of a simple behavior tree with just a sequence and multiple action clients as children.
The cancellation of the tree results in a seg fault on emitWakeUpSignal call in the result_callback lamda function of bt_action_node action client (observed using gdb backtrace).