Repository navigation
fix(autoware_behavior_velocity_traffic_light_module): shut down rclcpp after each fixture test - #13507
Merged
xmfcx merged 1 commit intoOct 21, 2026
Conversation
…p after each fixture test TrafficLightModuleTest::SetUp calls rclcpp::init() when the context is not ok, but nothing calls rclcpp::shutdown(). The default context then stays valid until exit, and its static destructor calls Context::shutdown() while other statics are already gone. This segfaults the test binary after all tests pass, in about 1 of 10 runs. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13507 +/- ##
==========================================
- Coverage 37.68% 37.64% -0.05%
==========================================
Files 2034 2037 +3
Lines 141948 142131 +183
==========================================
+ Hits 53500 53505 +5
- Misses 88448 88626 +178
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xmfcx
marked this pull request as ready for review
October 16, 2026 18:54
mitsudome-r
approved these changes
Oct 20, 2026
paulsohn-github-app Bot
pushed a commit
to paulsohn/autoware_universe_planning_2
that referenced
this pull request
Oct 21, 2026
…p after each fixture test (autowarefoundation/autoware_universe#13507) TrafficLightModuleTest::SetUp calls rclcpp::init() when the context is not ok, but nothing calls rclcpp::shutdown(). The default context then stays valid until exit, and its static destructor calls Context::shutdown() while other statics are already gone. This segfaults the test binary after all tests pass, in about 1 of 10 runs. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
shmpwk
pushed a commit
to tier4/pilot_auto_planning
that referenced
this pull request
Nov 5, 2026
…p after each fixture test (autowarefoundation/autoware_universe#13507) TrafficLightModuleTest::SetUp calls rclcpp::init() when the context is not ok, but nothing calls rclcpp::shutdown(). The default context then stays valid until exit, and its static destructor calls Context::shutdown() while other statics are already gone. This segfaults the test binary after all tests pass, in about 1 of 10 runs. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
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
test_autoware_behavior_velocity_traffic_light_modulesometimes passes all 13 tests and then exits with SIGSEGV (-11). CTest then marks it failed.The cause is in
TrafficLightModuleTest. ItsSetUpcallsrclcpp::init()when the context is not ok, but no test callsrclcpp::shutdown(). The tests intest_node_interface.cppdo shut down. So the default context stays valid until the process exits. Its static destructor then callsContext::shutdown()during exit, and that can crash. The likely reason is that other static objects that it needs are already destroyed at that point. The backtrace does not show which one.The backtrace of a crash:
This PR adds a
TearDown()that callsrclcpp::shutdown().SetUpalready callsrclcpp::init()again when the context is not ok, so each test gets a fresh context.Related links
The failure on
mainof autoware_core, in thebuild-and-test-jazzy-abovejob, which builds this package from autoware_universemain:How was this PR tested?
See Verification below.
Notes for reviewers
None.
Interface changes
None.
Effects on system behavior
None. Only a test changes.
AI usage
AI usage: Written with Claude Code in Breeze from the failed autoware_core CI runs. It reproduced the crash, read the core dumps, and wrote the fix.
Self-review: One review round by a separate AI session with a clean context, on
ec58127e4f. It found no problem in the code. It found one contradiction in this description, which is now fixed. It also noted a side benefit: the fixture no longer leaves a context alive, so the unguardedrclcpp::init()intest_node_interface.cppwould no longer throw under--gtest_shuffle.Verification: The test binary ran 240 times before and after the fix on ROS 2 Jazzy with Cyclone DDS: 27 crashes before, 0 after.
colcon testof the package passes.Repeat run before the fix
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp(the same as the CI job), autoware_universe at4fb338fa76. The test file is the same as onmain.ROS_DOMAIN_ID: 27 of 240 exited with 139 (SIGSEGV). Each crash log ends with[ PASSED ] 13 tests., the same as in CI.Core dumps
Repeat run after the fix
colcon build --packages-select autoware_behavior_velocity_traffic_light_module, then the same 240 runs: 240 of 240 exited with 0.colcon test
colcon test --packages-select autoware_behavior_velocity_traffic_light_module:50 tests, 0 errors, 0 failures, 14 skipped(the skips are cppcheck).Did not run: Humble, because the local workspace is Jazzy only.
Did not run: Fast DDS or Zenoh. I tested only Cyclone DDS, which the CI job uses.
Did not run: the CI of autoware_core or autoware_universe with this change.