Closed GoesM closed 1 week ago
Yeah! Can you submit the backport PR to Humble? Happy to review/merge!
My pleasure ^_^
I also have a check on Iron
, and Iron
also have the same issue, shall I submit another backport PR to Iron ?
Merged!
shall I submit another backport PR to Iron ?
Sure!
Bug report
Required Info:
Steps to reproduce issue
Launch the navigation2 normally, as following steps:
Expected behavior
no NullPtr bug occured.
Actual behavior
the Asan report of this NullPtr bug is as following:
Additional information
It's a shutdown-issue
First, based on my execution logs, I can confirm this is a shutdown issue.
the casue analysis
Below is an analysis of the cause of this bug:
The actionserver binds the computeControl() function as a callback function:
https://github.com/ros-navigation/navigation2/blob/635880d3d6ad1f23eb75d793409189c653797f58/nav2_controller/src/controller_server.cpp#L228-L234
Therefore, when the actionserver receives a task command, it will invoke the function path computeControl() -> computeAndPublishVelocity():
https://github.com/ros-navigation/navigation2/blob/635880d3d6ad1f23eb75d793409189c653797f58/nav2_controller/src/controller_server.cpp#L482
The
computeAndPublishVelocity()
function directly uses the functiongetRobotPose()
ofcostmap_ros_
for calculations:https://github.com/ros-navigation/navigation2/blob/635880d3d6ad1f23eb75d793409189c653797f58/nav2_controller/src/controller_server.cpp#L584-L591
This causes the
action_server_
to access the internal memory ofcostmap_ros_
during thegetRobotPose()
execution. However, it should be noted that :although
nav2_costmap_ros
is a plugin, it is also an independent ROS2-LifecycleNode that actively responds to exit signals.Therefore,
costmap_ros
might respond to signals fromrclcpp::ok()
and exit earlier than thier parent-LifecycleNode, nav2_controller.If this response sequence occurs,
costmap_ros_
might have already exited and released its memory BUT nav2_controller'saction_server_
is still executing calculations, leading to access of released memory and thus an error.Additional information for the additional information:
Note: This should be a very similar (or even the same) issue occurred with following ISSUEs , in which here're our previous discussion and fix into
main
branch:https://github.com/ros-navigation/navigation2/issues/3971#issue-2001528486
https://github.com/ros-navigation/navigation2/pull/3972#issuecomment-1820538411
I noticed that such fix is deployed into
main
but not intohumble
so that the similar bug occurs again.suggestion
Shall we push such change for
costmap_ros_
frommain
intohumble
?