Skip to content

Don't leak the rcl wait set when a wait set constructor throws - #3407

Draft
mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/wait-set-leak-on-throw
Draft

mjcarroll wants to merge 1 commit into
rollingfrom
mjcarroll/wait-set-leak-on-throw

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Description

Fixes a leak: if StoragePolicyCommon's first rebuild throws, the destructor never runs and the rcl wait set isn't finalized. Now it's finalized before rethrowing.

Is this user-facing behavior change?

No.

Did you use Generative AI?

Claude Code (Claude Opus 5.5) found this under ASan and wrote the change; I reviewed it.

Additional Information

None.

StoragePolicyCommon's constructor initializes the rcl wait set, then
rebuilds it, which can throw (e.g. a static wait set that needs pruning,
or rcl_wait_set_clear failing). The destructor doesn't run when the
constructor throws, so the rcl wait set was never finalized. Finalize it
before rethrowing.

Found with LeakSanitizer in test_static_storage
(fixed_storage_needs_pruning) and test_executor
(create_executor_fail_wait_set_clear).

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 @ 1e2a323
(empty report — no differences printed by abidiff)
✅ librclcpp.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp.so
  • Head: lib-pr/librclcpp.so @ 1e2a323
Functions changes summary: 0 Removed (3 filtered out), 0 Changed (124 filtered out), 0 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable


✅ librclcpp_action.so — full abidiff report

Compared:

  • Base: lib-base/librclcpp_action.so
  • Head: lib-pr/librclcpp_action.so @ 1e2a323
(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 @ 1e2a323
(empty report — no differences printed by abidiff)

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

@mjcarroll
mjcarroll marked this pull request as draft November 10, 2026 02:41
@mjcarroll mjcarroll added the sanitizers Found with or related to ASan/LSan/UBSan/TSan label Nov 10, 2026
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.

1 participant