Release ROS adapter resources during shutdown - #566
Open
ktyang512 wants to merge 1 commit into
Open
Conversation
Signed-off-by: ktyang512 <ktyang512@gmail.com>
|
Tick the box to add this pull request to the merge queue (same as
|
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.
Description
Fixes #565.
ROSAdapter.shutdown()stopped its executor thread and shut down its node andcontext, but it retained the node wrapper and did not shut down the executor
itself. In repeated launch tests, the retained rclpy/Fast DDS resources were
only released by delayed cyclic garbage collection, so file descriptors and DDS
threads accumulated until another file or pipe creation failed with
EMFILE.This change explicitly shuts down the executor and releases the adapter's node
and private thread references after shutdown. It also adds a regression
covering executor cleanup, node release, and restart with fresh resources.
Is this user-facing behavior change?
After
ROSAdapter.shutdown(), itsros_nodeproperty now returnsNoneinstead of a destroyed node. The stopped context and executor remain
inspectable, and calling
start()replaces all three with fresh objects.Did you use Generative AI?
Yes. OpenAI Codex (GPT-5) assisted with candidate research, reproduction,
diagnosis, implementation, test design, and drafting. I reviewed the final diff
and validation evidence before submission.
Additional Information
Local validation on Rolling with Fast DDS:
with this change;
launch_ros/testtests pass, including copyright, flake8, and pep257;test_launch_container_executor_modespass underulimit -n 64in 118.59seconds, with file descriptors and threads stable at 11 and 8 after every
case;
git diff --checkpasses.Not tested locally: the full multi-package repository suite, ROS buildfarm
jobs, Windows, aarch64, or non-Fast-DDS RMW implementations.