Skip to content

Commit

Permalink
Fixed ros2 node ptr destruction problem, which gives rise to finish w…
Browse files Browse the repository at this point in the history
…ith unsoundly

- First insights: It seems benhcmark nodes shouldn't store the shared ptrs of ros nodes etc.
  while rclcpp::shutdown is running
  Otherwise, benchmark sometimes finishes unsoundly like below.

	[ERROR] [1713850255.212319171] [bla_bla_node.rclcpp]: Error in destruction of rcl subscription handle: Failed to delete datareader, at ./src/subscription.cpp:52, at ./src/rcl/subscription.c:184
	cannot publish data, at ./src/rmw_publish.cpp:62 during '__function__'
	Fail in delete datareader, at ./src/rmw_service.cpp:104 during '__function__'
  • Loading branch information
CihatAltiparmak committed Jul 11, 2024
1 parent e61a02a commit 398bada
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scenarios/scenario_perception_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ void ScenarioPerceptionPipelineFixture::SetUp(::benchmark::State& /*state*/)

void ScenarioPerceptionPipelineFixture::TearDown(::benchmark::State& /*state*/)
{
// Reset ros2 node shared pointers and their service, subscriber,
// and publisher shared ptrs etc. before rclcpp::shutdown is not run.
// Because move_group_interface includes private node. Additionally,
// Some destructors can be run once process finishes and as soon as
// rclcpp::shutdown() finishes its own job.
move_group_interface_ptr_.reset();
node_.reset();
}

void ScenarioPerceptionPipelineFixture::createTestCases()
Expand Down

0 comments on commit 398bada

Please sign in to comment.