Skip to content

Fix race condition when creating isolated component container (backport #3223) - #3228

Merged
skyegalaxy merged 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-3223
Aug 13, 2026
Merged

Fix race condition when creating isolated component container (backport #3223)#3228
skyegalaxy merged 1 commit into
lyricalfrom
mergify/bp/lyrical/pr-3223

Conversation

@mergify

@mergify mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Fix race condition when creating isolated component container

What

The isolated component_container created a throwaway ComponentManager solely to read the thread_num parameter, then destroyed it and re-created the real ComponentManagerIsolated. This briefly advertised the container's ~/_container/load_node service and tore it down, racing LoadComposableNodes clients and silently dropping load requests.

Changes

  • component_container.cpp: construct the manager once, directly as its final type. Isolated managers are now built with num_threads == 0 ("auto").
  • component_manager_isolated.hpp: in add_node_to_executor, num_threads_ == 0 now resolves the thread_num parameter itself (defaults to hardware concurrency), so the container no longer needs to read it up front.
  • Added a regression test (isolated_multi_threaded_auto_thread_num) covering the isolated multi-threaded "auto" path.

Notes

  • ABI-safe: only an executable and an inline template method body change; ComponentManager's layout is untouched.
  • Behavior preserved, including -p thread_num:=N for isolated multi-threaded/events executors.
  • Cleanly backportable to lyrical (identical baseline).

Fixes #3222

Is this user-facing behavior change?

Did you use Generative AI?

Additional Information


This is an automatic backport of pull request #3223 done by [Mergify](https://mergify.com).

* Refactor thread management in ComponentManagerIsolated to handle thread_num parameter dynamically

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

* Add test for isolated multi-threaded component manager with auto thread resolution

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

---------

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
(cherry picked from commit 81ec3e3)
@skyegalaxy

Copy link
Copy Markdown
Member

Pulls: #3228
Gist: https://gist.githubusercontent.com/skyegalaxy/e19815dc0cd2c09ede3fe2deaf7d541e/raw/f2f7f1d4800ec4ef046a027d85ea6f288095128f/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp
TEST args: --packages-above rclcpp
ROS Distro: lyrical
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/20076

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

@mergify

mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

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

  • Queue this pull request

@skyegalaxy
skyegalaxy merged commit 76dd360 into lyrical Aug 13, 2026
3 checks passed
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.

2 participants