Skip to content

fix: populate reception_sequence_number and advertise sequence number features#920

Merged
ahcorde merged 2 commits intoros2:rollingfrom
ZettaScaleLabs:fix/sequence-numbers-v2
Mar 10, 2026
Merged

fix: populate reception_sequence_number and advertise sequence number features#920
ahcorde merged 2 commits intoros2:rollingfrom
ZettaScaleLabs:fix/sequence-numbers-v2

Conversation

@YuanYuYuan
Copy link
Contributor

@YuanYuYuan YuanYuYuan commented Mar 9, 2026

Description

rmw_feature_supported currently returns false for both RMW_FEATURE_MESSAGE_INFO_PUBLICATION_SEQUENCE_NUMBER and RMW_FEATURE_MESSAGE_INFO_RECEPTION_SEQUENCE_NUMBER, causing rclcpp to skip populating these fields in rclcpp::MessageInfo entirely. Additionally, reception_sequence_number is always set to 0 with a TODO comment at both take sites.

The fix:

  • Flips rmw_feature_supported to return true for both sequence number features.
  • Adds a std::atomic<uint64_t> reception_sn_ counter to SubscriptionData, initialized to 0. Each call to take_one_message or take_serialized_message increments it with fetch_add(1, std::memory_order_relaxed) and assigns the pre-increment value to message_info->reception_sequence_number.
  • publication_sequence_number was already populated from the attachment; no change needed there.

The attachment wire format (sequence_number | source_timestamp | source_gid) is unchanged — this fix is purely in the subscriber-side bookkeeping.

Closes #907
Closes #906

@ahcorde
Copy link
Contributor

ahcorde commented Mar 9, 2026

Pulls: #920
Gist: https://gist.githubusercontent.com/ahcorde/b2533d084a639b88d6b650c6ae348509/raw/a444cadcc6b118b3dc49af597e82f6c39bde41c4/ros2.repos
BUILD args: --packages-above-and-dependencies rmw_zenoh_cpp
TEST args: --packages-above rmw_zenoh_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18406

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

@ahcorde ahcorde merged commit 3cbcffb into ros2:rolling Mar 10, 2026
4 of 5 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented Mar 10, 2026

@YuanYuYuan or @JEnoch should we backport this ?

@YuanYuYuan
Copy link
Contributor Author

@YuanYuYuan or @JEnoch should we backport this ?

I think we could backport it. This feature has landed since Humble ros2/rmw#318, and the API change is distro-agnostic.

@ahcorde
Copy link
Contributor

ahcorde commented Mar 11, 2026

https://github.com/Mergifyio backport kilted jazzy humble

@mergify
Copy link

mergify bot commented Mar 11, 2026

backport kilted jazzy humble

✅ Backports have been created

Details

Cherry-pick of 3cbcffb has failed:

On branch mergify/bp/humble/pr-920
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit 3cbcffb.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
	modified:   rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   rmw_zenoh_cpp/src/rmw_zenoh.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

mergify bot pushed a commit that referenced this pull request Mar 11, 2026
mergify bot pushed a commit that referenced this pull request Mar 11, 2026
mergify bot pushed a commit that referenced this pull request Mar 11, 2026
… features (#920)

(cherry picked from commit 3cbcffb)

# Conflicts:
#	rmw_zenoh_cpp/src/rmw_zenoh.cpp
ahcorde pushed a commit that referenced this pull request Mar 11, 2026
… features (#920) (#923)

(cherry picked from commit 3cbcffb)

Co-authored-by: Yuyuan Yuan <az6980522@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants