Skip to content

Check for association with an executor before removing nodes in ComponentManager#3190

Open
skyegalaxy wants to merge 3 commits into
rollingfrom
skyegalaxy/no-throw-on-nonexistent-node-removal
Open

Check for association with an executor before removing nodes in ComponentManager#3190
skyegalaxy wants to merge 3 commits into
rollingfrom
skyegalaxy/no-throw-on-nonexistent-node-removal

Conversation

@skyegalaxy

@skyegalaxy skyegalaxy commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

This PR changes the destructor of component_manager to check each node it's removing for if it is already associated with an executor.

A regression test has also been added to test_component_manager_api in rclcpp_components, which asserts that an exception isn't thrown during the double-removal case as outlined in #3186

Fixes #3186

Is this user-facing behavior change?

  • Users will no longer get an exception on shutdown when using component managers with the callback group events executor

Did you use Generative AI?

Claude Opus 4.8

Additional Information

@skyegalaxy skyegalaxy requested a review from jmachowinski July 10, 2026 19:40
@skyegalaxy skyegalaxy self-assigned this Jul 10, 2026
@skyegalaxy skyegalaxy added the bug Something isn't working label Jul 10, 2026
@mergify

mergify Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ahcorde

ahcorde commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Pulls: #3190
Gist: https://gist.githubusercontent.com/ahcorde/0921923647104ed12128ae08da3c7b80/raw/62b669e2d3ce5aba62ac68d53a57e0c095eb3cfa/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp rclcpp_components
TEST args: --packages-above rclcpp rclcpp_components
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19824

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have 2 comments.

  • * \throw std::runtime_error if the node is not associated with an executor.
    should be also updated align with implementation.
  • normal Ctrl+C shutdown will now WARN-spam once per node, every time. the double-remove sequence is still deterministic though. either the coordination should also be fixed (e.g., ~ComponentManager skips nodes whose association flag is already clear, or EventsCBGExecutor's shutdown notifies/clears differently)? warning on every clean shutdown trains users to ignore warnings?

@skyegalaxy

Copy link
Copy Markdown
Member Author

I appreciate your review and feedback @fujitatomoya ! I updated the docstrings here and also added a check in the component manager destructor for if the node's already associated with an executor before removing. That gets rid of the warning for the test case I added on my end.

@skyegalaxy skyegalaxy requested a review from fujitatomoya July 13, 2026 21:14
@skyegalaxy

Copy link
Copy Markdown
Member Author
  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@jmachowinski

Copy link
Copy Markdown
Collaborator

Hm, so now we are anyway at the point, were we fixed the source of the exception. Should we leave it in then ?

@skyegalaxy

Copy link
Copy Markdown
Member Author

yeah you're right @jmachowinski , I'll keep the check in component container and undo my other changes

Skyler Medeiros added 3 commits July 14, 2026 11:27
Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com>
Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com>
Signed-off-by: Skyler Medeiros <skye@polymathrobotics.com>
@skyegalaxy skyegalaxy force-pushed the skyegalaxy/no-throw-on-nonexistent-node-removal branch from 8d04f58 to cdc1c94 Compare July 14, 2026 19:57
@skyegalaxy skyegalaxy changed the title Don't throw an exception if removing a node not associated with any executor Check for association with an executor before removing nodes in ComponentManager Jul 14, 2026
@skyegalaxy

Copy link
Copy Markdown
Member Author

I removed the commits which got rid of the exception, and updated the PR title and description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventsCBGExecutor shutdown + ComponentManager destructor cause double remove and runtime_error on shutdown

4 participants