Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Plans to support loaned-messages shared-memory APIs? #175

Open
mauropasse opened this issue May 17, 2024 · 3 comments
Open

Question: Plans to support loaned-messages shared-memory APIs? #175

mauropasse opened this issue May 17, 2024 · 3 comments

Comments

@mauropasse
Copy link

mauropasse commented May 17, 2024

Hi! I've running some ROS2 benchmarks on rmw_zenoh using the iRobot ros2-performance framework, and it looks promising. However I noticed the lack of support for loaned messages APIs like:

rmw_borrow_loaned_message(
const rmw_publisher_t * publisher,
const rosidl_message_type_support_t * type_support,
void ** ros_message)
{
static_cast<void>(publisher);
static_cast<void>(type_support);
static_cast<void>(ros_message);
return RMW_RET_UNSUPPORTED;
}

It seems zenoh-c already supports shared memory: eclipse-zenoh/zenoh-c#156, https://zenoh.io/blog/2023-06-05-charmander2/, which should be present in the version used on rmw_zenoh.

So I'm wondering what's missing to fully implement shared memory on ROS2 systems, and if there is a plan in the roadmap to do so? This feature is key for performant multi-process applications.

@imstevenpmwork
Copy link
Contributor

imstevenpmwork commented May 17, 2024

Hello @mauropasse, would you mind sharing the benchmarks results with us? Just for curiosity :)
In the meantime I'll check with the rest of the team regarding your question. For now what I can tell you is that the rolling branch in rmw_zenoh doesn't use yet the latest zenoh-c release, but this will be updated soon: #174

@clalancette
Copy link
Collaborator

So I'm wondering what's missing to fully implement shared memory on ROS2 systems, and if there is a plan in the roadmap to do so? This feature is key for performant multi-process applications.

We haven't prioritized loaned messages, mostly because they are disabled by default in Rolling and Jazzy (as they are currently unsafe to use).

At the moment, we don't have a plan to implement them, but it would be great to complete the API in this way. If you are interested in looking into it, we'd be happy to review patches. Otherwise, it will probably be a long-term goal.

@mauropasse
Copy link
Author

Hi guys! I've been working on a PR ros2/rclcpp#2624 that aims to re-enable the use of loaned messages on rclcpp.

It contains a unit test to verify correct memory handling when the last owner of the loaned message is either the:

  • User (storing messages beyond the subscription callback).
  • Subscription (storing messages until it is executed).
  • Publisher (storing messages for late joiner subscriptions).

By correctly memory handling I mean, memory should not be reused until all entities had returned the loans (all messages went ouf scope).

The test currently pass with CycloneDDS & FastDDS. I didn't test Zenoh since rmw_zenoh_cpp doesn't yet implement the loaned APIs.

My question is, supposing that the APIs were implemented, would Zenoh correctly handle the situations described above? Or that would depend actually on the implems on the missing APIs, described here https://design.ros2.org/articles/zero_copy.html

Besides that, are there any updates on using zenoh-c > v1.0.0, which comes with support for shared memory?

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

No branches or pull requests

3 participants