Skip to content

Fix move_group segfaults on SIGINT - #3996

Open
benaliabderrahmane wants to merge 1 commit into
moveit:mainfrom
benaliabderrahmane:fix/move-group-sigint-segfault
Open

benaliabderrahmane wants to merge 1 commit into
moveit:mainfrom
benaliabderrahmane:fix/move-group-sigint-segfault

Conversation

@benaliabderrahmane

@benaliabderrahmane benaliabderrahmane commented Nov 24, 2026 •

Copy link
Copy Markdown

Description

move_group still segfaults on SIGINT on Jazzy 2.12.4 (follow-up to #3268). Plugin libraries are unloaded while rclcpp nodes/executors still reference entities the plugins created, so releasing them reads vtables from unmapped memory.

  • move_group.cpp: keep the capability plugin loader alive until after the node.
  • TrajectoryExecutionManager: release the controller manager node and executor before the plugin is unloaded (destructor only, ABI-safe).

Tested on Jazzy 2.12.4 (UR5e Gazebo + MoveIt): segfault 3/3 before, 0/5 after.

Checklist

  • Code is auto formatted using clang-format
  • Create tests, which fail without this PR (no active move_group tests; verified manually)

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup during shutdown of trajectory execution. Associated resources are now released after execution is cancelled and its worker thread has completed, helping prevent resources from lingering after shutdown. This change does not alter the behavior of planning or trajectory execution while the system is running.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a getter for the move-group capability plugin loader and stores its result in main. The trajectory execution manager destructor now resets its private executor and controller-manager node after cancelling the executor and joining its thread.

Changes: Capability loader access

Layer / File(s) Summary
Expose and store capability plugin loader
moveit_ros/move_group/src/move_group.cpp
MoveGroupExe adds a getter for its capability plugin loader. main stores the loader returned by the instance.

Trajectory execution manager cleanup

Layer / File(s) Summary
Reset members during destruction
moveit_ros/planning/trajectory_execution_manager/src/trajectory_execution_manager.cpp
The destructor resets private_executor_ and controller_mgr_node_ after cancelling the executor and joining its thread.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: rhaschke, jafarabdi

Merge Risk: Minimal · up to 49362

The change reorders shutdown so plugin libraries stay loaded until the node and capabilities are released, which targets the reported move_group SIGINT segfault. No concrete defects were found in the reviewed code, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Fix move_group segfaults on SIGINT" names the main change. The PR fixes a shutdown segfault in move_group by changing destruction order: the capability plugin loader is kept alive through n…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "Fix move_group segfaults on SIGINT" names the main change. The PR fixes a shutdown segfault in move_group by changing destruction order: the capability plugin loader is kept alive through node teardown, and TrajectoryExecutionManager releases its controller manager node and executor before the controller manager plugin unloads. The title states the bug and the trigger concisely. The title does not name the mechanism, but the PR objectives confirm it covers the main change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8c99e52 and 4936250.

Files selected for processing: 2

  • moveit_ros/move_group/src/move_group.cpp
  • moveit_ros/planning/trajectory_execution_manager/src/trajectory_execution_manager.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@benaliabderrahmane
benaliabderrahmane force-pushed the fix/move-group-sigint-segfault branch from 5ccc3fd to 4936250 Compare November 24, 2026 22:55
@benaliabderrahmane
benaliabderrahmane marked this pull request as ready for review November 24, 2026 22:56
@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.93%. Comparing base (8c99e52) to head (4936250).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3996      +/-   ##
==========================================
+ Coverage   48.92%   48.93%   +0.02%     
==========================================
  Files         735      735              
  Lines       62699    62705       +6     
  Branches     7629     7630       +1     
==========================================
+ Hits        30669    30680      +11     
+ Misses      32030    32025       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Plugin libraries were unloaded while rclcpp nodes and executors still
referenced entities the plugins created; releasing those references
afterwards read vtables from unmapped memory.

- move_group: keep the capability plugin loader alive until after the node.
- TrajectoryExecutionManager: release the controller manager node and
  executor before the controller manager plugin is unloaded.
@benaliabderrahmane
benaliabderrahmane force-pushed the fix/move-group-sigint-segfault branch from 4936250 to fabc849 Compare December 1, 2026 16:20
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