Skip to content

test_node_graph: release arrays when the mocked fini fails - #3454

Merged
mjcarroll merged 1 commit into
ros2:rollingfrom
mjcarroll:fix-node-graph-test-leaks
Dec 1, 2026
Merged

mjcarroll merged 1 commit into
ros2:rollingfrom
mjcarroll:fix-node-graph-test-leaks

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Description

The test_node_graph tests that make rcl_names_and_types_fini(), rcutils_string_array_fini() or rcl_topic_endpoint_info_array_fini() fail on purpose never release the array the code under test allocated, so LeakSanitizer reports 18 leaks in test_node_interfaces__node_graph.

The replacement functions now free the memory before returning the error. rcl_names_and_types_fini() and rcl_topic_endpoint_info_array_fini() are the rmw functions under another name, so the replacements can't call them (the mock would recurse) and use rmw_names_and_types_fini() and a manual cleanup instead.

Test only. Found with AddressSanitizer, which is clean for this target after the change.

Is this user-facing behavior change?

No.

Did you use Generative AI?

Yes, Claude Code, for finding the cause and writing the change.

Additional Information

Tested with and without AddressSanitizer.

Tests that make rcl_names_and_types_fini(), rcutils_string_array_fini() or rcl_topic_endpoint_info_array_fini() fail leave the array allocated by the code under test unreleased, which LeakSanitizer reports. Have the replacement functions free the memory before returning the error.

Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
@github-actions

Copy link
Copy Markdown

ABI Compliance Check

✅ Verdict: compatible

Library Verdict Summary
libcomponent_manager.so ✅ compatible No ABI changes detected.
librclcpp.so ✅ compatible No ABI changes detected.
librclcpp_action.so ✅ compatible No ABI changes detected.
librclcpp_lifecycle.so ✅ compatible No ABI changes detected.
✅ libcomponent_manager.so — full abidiff report

Compared:

  • Base: lib-base/libcomponent_manager.so
  • Head: lib-pr/libcomponent_manager.so @ 551cb6b
(empty report — no differences printed by abidiff)
✅ librclcpp.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp.so
  • Head: lib-pr/librclcpp.so @ 551cb6b
(empty report — no differences printed by abidiff)
✅ librclcpp_action.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_action.so
  • Head: lib-pr/librclcpp_action.so @ 551cb6b
(empty report — no differences printed by abidiff)
✅ librclcpp_lifecycle.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_lifecycle.so
  • Head: lib-pr/librclcpp_lifecycle.so @ 551cb6b
(empty report — no differences printed by abidiff)

Updated for commit 551cb6b · check run · suppressions: /home/runner/work/_temp/ros2-abi-suppressions.txt

@christophebedard christophebedard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mjcarroll

mjcarroll commented Nov 29, 2026 •

Copy link
Copy Markdown
Member Author

CI for this PR, built together with #3452, #3453, #3454, #3455 and #3458 on one branch (all five merge cleanly): https://ci.ros2.org/job/ci_launcher/21407

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

@mjcarroll mjcarroll self-assigned this Dec 1, 2026
@mjcarroll
mjcarroll merged commit 0f910dc into ros2:rolling Dec 1, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants