Skip to content

test_qos_event: declare event counters before the entities that call them - #3453

Open
mjcarroll wants to merge 1 commit into
ros2:rollingfrom
mjcarroll:fix-qos-event-test-counters
Open

mjcarroll wants to merge 1 commit into
ros2:rollingfrom
mjcarroll:fix-qos-event-test-counters

Conversation

@mjcarroll

Copy link
Copy Markdown
Member

Description

test_on_new_event_callback installs callbacks that capture local std::atomics by reference on a publisher and subscription whose deadline events fire every few milliseconds on the middleware's thread. The counters were declared after the publisher and subscription, so they were destroyed first and the still-running callbacks wrote to dead stack memory.

Declare the counters before the entities.

Found with AddressSanitizer (stack-use-after-scope in test_qos_event). This can crash or corrupt the stack nondeterministically at the end of the test.

Is this user-facing behavior change?

No, test only.

Did you use Generative AI?

Yes, Claude Code, for diagnosing the ASan report and writing the change. Tested with AddressSanitizer.

Additional Information

…them

test_on_new_event_callback installed callbacks capturing local atomics by reference on a publisher/subscription whose deadline events fire every few milliseconds on the middleware's thread. The counters were declared after the publisher and subscription, so they were destroyed first and the still-running callbacks wrote to dead stack memory (AddressSanitizer: stack-use-after-scope). Declare them before the entities.

Signed-off-by: Michael Carroll <[email protected]>
@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 @ 8e5259b
(empty report — no differences printed by abidiff)
✅ librclcpp.so — full abidiff report

Compared:

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

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

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