Skip to content

Keep callback-group guard conditions alive in Executor#3114

Open
ralwing wants to merge 2 commits intoros2:humblefrom
AutonomousSystemsPL:sdp4661-guard-condition-humble
Open

Keep callback-group guard conditions alive in Executor#3114
ralwing wants to merge 2 commits intoros2:humblefrom
AutonomousSystemsPL:sdp4661-guard-condition-humble

Conversation

@ralwing
Copy link

@ralwing ralwing commented Mar 25, 2026

Description

This pull request updates the ExecutorEntitiesCollector class to improve the management of guard condition pointers. The most important change is switching from weak pointers to shared pointers for guard conditions in internal maps, which helps prevent premature destruction and potential use-after-free errors.

Pointer management improvements:

  • Changed the value type in both WeakNodesToGuardConditionsMap and WeakGroupsToGuardConditionsMap from rclcpp::GuardCondition::WeakPtr to rclcpp::GuardCondition::SharedPtr in executor_entities_collector.hpp. This ensures guard conditions remain alive as long as they're needed by the executor.

Fixes #2163 autowarefoundation/autoware_core#694 ros2/rmw_zenoh#608 autowarefoundation/autoware_universe#6452

According to #2820 (comment) it's already fixed in rolling 2025.4

Is this user-facing behavior change?

This breaks the downstream ABI. All libraries must be rebuilt.

Did you use Generative AI?

I used GitHub Copilot model Claude-Opus: 4.6

Store callback-group notify guard conditions in the executor map with shared ownership instead of raw pointers. This prevents guard conditions from being finalized while still referenced by the memory strategy during wait set rebuilds, avoiding intermittent 'failed to add guard condition to wait set: guard condition implementation is invalid' crashes under callback-group destruction races.

(cherry picked from commit 7c8ce04)
Signed-off-by: Grzegorz Głowacki <gglowacki@autonomous-systems.pl>
Signed-off-by: Grzegorz Głowacki <gglowacki@autonomous-systems.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant