Prevent executor race condition#421
Draft
mjcarroll wants to merge 1 commit into
Draft
Conversation
This is a hypothesis that works locally, but I would like to run through CI. Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
Contributor
Author
|
Pulls: #421 |
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
This PR fixes a sporadic hang/deadlock in the camera_info_manager unit tests (https://ci.ros2.org/view/nightly/job/nightly_linux-aarch64_repeated/3582/testReport/junit/(root)/projectroot/camera_info_manager_unit_test/)
Root Cause
In tests/unit_test.cpp, the CameraInfoManagerTesting fixture spins an executor in a background thread during SetUp():
And cancels/joins it during TearDown() :
For very fast test cases, purely synchronous test cases the main thread completes and calls TearDown() almost immediately after SetUp(). This creates a race condition in rclcpp::Executor:
sets spinning back to true .
thread never joins, causing the test suite to hang.
Is this user-facing behavior change?
No (test code only).
Did you use Generative AI?
Yes, this pull request description and fix were prepared with the assistance of Gemini CLI.
Assisted-by: Gemini CLI:Gemini 3.5 Flash [run_command, view_file, grep_search, replace_file_content]
Additional Information
I think this is actually a valid race condition that we are going to potentially need to address in the executor?