Skip to content

Populate message info for intra-process messages - #3271

Open
thomasmoore-torc wants to merge 3 commits into
ros2:rollingfrom
thomasmoore-torc:intra-process-message-info
Open

thomasmoore-torc wants to merge 3 commits into
ros2:rollingfrom
thomasmoore-torc:intra-process-message-info

Conversation

@thomasmoore-torc

@thomasmoore-torc thomasmoore-torc commented Sep 14, 2026

Copy link
Copy Markdown

rclcpp: Populate message info for intra-process messages

Branch: intra-process-message-info (this repo: ros2/rclcpp)
Related PR: #3272 — "Iterate over IntraProcessBuffer instead of creating a vector" (intra-process-reduce-copies). See Landing order below — no functional dependency, but the two touch overlapping code.

Summary

Subscriptions that receive a message via intra-process delivery currently get a default-constructed, empty rmw_message_info_t — no sequence number, no publisher GID, no from_intra_process flag. The same subscription receiving the same message via inter-process (rmw) delivery gets a fully populated one. Anything relying on message_info (deduplicating by publisher GID, checking from_intra_process, etc.) behaves inconsistently depending on whether a given publish happens to stay in-process or not.

This populates message_info for intra-process messages too, so subscribers see consistent, meaningful info regardless of delivery path.

Changes

  • Populate message info for intra-process messages — threads an rmw_message_info_t alongside the message through the intra-process publish path (Publisher::do_intra_process_publish/do_intra_process_ros_message_publish_and_return_sharedIntraProcessManagerIntraProcessBuffer → subscription).
    • IntraProcessBuffer storage changes from a bare shared_ptr/unique_ptr to a bundled IntraProcessBufferData (message + rmw_message_info_t), added with a copy constructor that deep-copies the unique-ptr alternative (needed so get_all_data()-based paths, e.g. transient-local replay, keep working with move-only storage).
    • Fixes do_transient_local_publish to correctly convert between shared/unique storage and shared/unique subscription requests via std::visit instead of assuming the two always match.
  • Move IntraProcessBufferData to its own header — pulls the new struct out into intra_process_buffer_data.hpp to keep intra_process_buffer.hpp focused and avoid a circular-ish coupling between buffer and data definitions.
  • Update intra-process unit tests — updates test_intra_process_buffer.cpp and test_intra_process_manager.cpp for the new Data/IntraProcessBufferData API and adds coverage for message-info propagation across both shared- and unique-ownership subscriptions.

Compatibility

Internal to rclcpp's intra-process implementation (rclcpp::experimental::*); no public API signature changes. Behavior change: intra-process subscribers now observe non-default message_info where they previously saw an empty one.

Testing

Built and tested against rolling in a ros:rolling-ros-base container via colcon build/colcon test for rclcpp (3091 tests, 0 failures), plus uncrustify/cpplint lint targets. All green.

Landing order

intra-process-reduce-copies (opened separately) touches the same files (intra_process_buffer.hpp, intra_process_manager.hpp, and both intra-process test files) as part of an unrelated copy-reduction optimization. The two branches are independently buildable and testable, but not free to merge in either order without a rebase — real textual conflicts exist between them (confirmed via a trial merge). No functional dependency either way; whichever of the two merges second will need to reconcile against the other.

🤖 Generated with Claude Code

(cherry picked from commit 8f255f3da12d5d0cc8aa5a49f69bb74339226820)
(cherry picked from commit 94a3d5856c046e3a7b6bda942394cd8662926c28)
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
(cherry picked from commit f2302935bd1b41a75f56c6a9f4ef5b7fbe4d7e9b)
(cherry picked from commit 8a875ee1df60afcdb7ed68ceb27f097acdcdacf0)
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant