Skip to content

Test matched events after count queries - #3279

Open
mini-1235 wants to merge 1 commit into
ros2:rollingfrom
mini-1235:test/matched-events-survive-count-queries
Open

mini-1235 wants to merge 1 commit into
ros2:rollingfrom
mini-1235:test/matched-events-survive-count-queries

Conversation

@mini-1235

Copy link
Copy Markdown
Contributor

Description

Regression test for ros2/rmw_cyclonedds#607

PublisherBase::get_subscription_count() and
SubscriptionBase::get_publisher_count() are count queries. Calling them should
not prevent an already-pending matched-event callback from being delivered.

A CycloneDDS RMW implementation issue caused these queries to read and reset the
underlying DDS matched status. This made the matched callbacks time out when the
count was queried.

Is this user-facing behavior change?

Yes for cyclonedds only, but not a change in rclcpp

Did you use Generative AI?

Yes, Codex 5.6 Sol

Additional Information

Signed-off-by: Maurice <mauricepurnawan@gmail.com>
@mini-1235

Copy link
Copy Markdown
Contributor Author

Without the patch in ros2/rmw_cyclonedds#607, the tests should fail, as shown in the screenshot below

Screenshot 2026-09-20 at 11-56-31

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

Compared:

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

Updated for commit aad3fc0 · suppressions: /home/runner/work/_temp/ros2-abi-suppressions.txt

@fujitatomoya

Copy link
Copy Markdown
Collaborator

note: okay now we can see the ABI compliance check result from the forked repository without write permission to the origin.

@kvnloo

kvnloo commented Sep 20, 2026

Copy link
Copy Markdown

I think this captures the right regression, but there may be a discovery-timing race in the test itself.

Right after creating the publisher and subscription, the test does:

ASSERT_EQ(1u, pub->get_subscription_count());
ASSERT_EQ(1u, sub->get_publisher_count());

without first waiting for DDS discovery to complete.

Elsewhere in the rclcpp tests, endpoint counts are generally treated as asynchronous. For example, "test_subscription.cpp" waits until both publisher/subscription counts become nonzero before continuing, and several other pub/sub tests have similar discovery waits.

We probably don't want to use these same two count calls for the wait here, though, because calling them is the operation this regression test is specifically verifying does not consume the pending matched event on CycloneDDS.

Could the test first wait for the endpoints to appear through graph-level discovery / endpoint info, then call "get_subscription_count()" and "get_publisher_count()" once to exercise the bug, and only after that spin the executor and assert both pending matched callbacks arrive?

That would keep the important RED/GREEN property against rmw_cyclonedds#607 while separating "DDS discovery completed" from "the count query did not consume the event".

AI assistance disclosure: reviewed with OpenAI ChatGPT GPT-5.6 Sol.

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@fujitatomoya

Copy link
Copy Markdown
Collaborator

Pulls: #3279, ros2/rmw_cyclonedds#607
Gist: https://gist.githubusercontent.com/fujitatomoya/1e95f73e9966569bb6699c68733f50c2/raw/60316acf16ffa71a881d271cdcc5927a02b53d7c/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp rmw_cyclonedds_cpp
TEST args: --packages-above rclcpp rmw_cyclonedds_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/20541

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

@fujitatomoya

Copy link
Copy Markdown
Collaborator

Note

backport required to lyrical kilted jazzy

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.

3 participants