Repository navigation
[ROS2] Keep rclcpp loaded until process exit - #1109
Merged
Merged
Conversation
Collaborator
Author
|
Tests fail due to: #1106 |
Contributor
|
I would suggest:
|
jhanca-robotecai
marked this pull request as ready for review
October 19, 2026 06:12
michalpelka
approved these changes
Oct 19, 2026
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
jhanca-robotecai
force-pushed
the
jh/fix_tests
branch
from
October 23, 2026 06:40
3f3eeca to
050b2f2
Compare
Collaborator
Author
|
Rebased on top of #1106 to ensure the tests pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
With ROS 2 Lyrical, processes that unload the ROS2 gem crash with SIGSEGV during process exit. The cause is in ROS 2:
rmw_implementationandrcl_logging_implementationunload their plugin libraries (librmw_fastrtps_cpp,librcl_logging_spdlog) during process exit, from a static destructor and anatexit()handler. When the ROS2 gem has been unloaded before, that plugin can be the last reference keeping the ROS 2 libraries loaded, so its unload also unmapslibrmw_implementation/librcl_logging_implementationwhile their code is still running.This PR makes
ROS2SystemComponent::Init()mark the already loadedlibrclcpp.soas non-unloadable (dlopen(..., RTLD_NOLOAD | RTLD_NODELETE)), right beforerclcpp::init(). rclcpp and everything it depends on, including both libraries above, then stay loaded until the process ends, so the exit-time unloads cannot unmap code that is still running.RTLD_NOLOADonly changes the flags of the library that is already loaded; nothing new is loaded. The ROS2 gem is Linux-only, sodlfcn.his available.How was this PR tested?
Ubuntu 26.04, ROS 2 Lyrical, clang 21, profile build of a project with the o3de-extras ROS 2 gems, engine 2705 (development based): tests pass with the fix;
SimulationInterfaces.ROS2Testswith thedlopencall suppressed (LD_PRELOADinterposer): exit code 139 without.