Skip to content

Unique network flows optional checks#872

Open
thomasmoore-torc wants to merge 12 commits into
ros2:rollingfrom
thomasmoore-torc:unique_network_flows_optional_checks
Open

Unique network flows optional checks#872
thomasmoore-torc wants to merge 12 commits into
ros2:rollingfrom
thomasmoore-torc:unique_network_flows_optional_checks

Conversation

@thomasmoore-torc
Copy link
Copy Markdown

@thomasmoore-torc thomasmoore-torc commented Mar 31, 2026

Description

As part of #711, the ros_discovery_info subscription was configured with RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_OPTIONALLY_REQUIRED. However, there are no criteria under which an optional unique network flow is actually optional and it ultimately behaves exactly the same as setting RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_STRICTLY_REQUIRED. There are several conditions under which unique network flows are not supported:

  1. When locators are explicitly specified (relevant Fast DDS docs) - this results in FastDDS generating an error if unique network flow is requested when locators are explicitly specified
  2. When static EDP is utilized (Unique Network Flows and Static Endpoint Discovery are incompatible eProsima/Fast-DDS#6348) - this results in user data not being received by the subscriber

The intent of this PR is to incorporate checks for these conditions such that a unique network flow will not be requested under these conditions when a subscription is created with RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_OPTIONALLY_REQUIRED. It also adds the RMW_FASTRTPS_USE_UNIQUE_NETWORK_FLOWS_FOR_ROS_DISCOVERY_INFO environment variable to enable the ability to disable requesting uinique network flows for the ros_discovery_info topic.

Is this user-facing behavior change?

This will enable the user to utilize features such as explicit locator specification or static EDP via the Fast DDS XML configuration files. It will also give the user the option to disable unique network flows for the ros_discovery_info topic.

Did you use Generative AI?

Claude Opus 4.6 was used via GitHub Copilot to assist with the analysis of the issue and to provide an initial implementation. The implementation was then manually refined.

Additional Information

We would like to backport this to Jazzy.

@thomasmoore-torc
Copy link
Copy Markdown
Author

It appears that the build is failing because e5c8a84 requires ros2/rmw@403ee71, but the build is utilizing rmw version 7.9.1-1noble.20260317.155120, which doesn't include ros2/rmw@403ee71.

I don't currently have permissions to the ci_launcher, so I'm unable to trigger a build with the needed version of rmw for the test to pass.

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

test would be ideal to add.

Comment thread rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/init_rmw_context_impl.hpp Outdated
Comment thread rmw_fastrtps_shared_cpp/src/init_rmw_context_impl.cpp Outdated
@asymingt asymingt requested a review from MiguelCompany April 16, 2026 16:47
Copy link
Copy Markdown
Collaborator

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

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

Apart from my comment below, this needs a rebase

Comment thread rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/init_rmw_context_impl.hpp Outdated
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 2da5a66 to 41fb2ad Compare April 21, 2026 02:48
…o RMW_FASTRTPS_ROS_DISCOVERY_INFO_UNIQUE_NETWORK_FLOWS

Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 41fb2ad to 452ec4f Compare April 21, 2026 02:51
@thomasmoore-torc
Copy link
Copy Markdown
Author

@MiguelCompany - I have rebased and addressed your comment. However, I'm still unable to get a successful build because of the issue I shared above: #872 (comment)

Comment thread rmw_fastrtps_shared_cpp/test/test_unique_network_flows.cpp Outdated
Comment thread rmw_fastrtps_shared_cpp/test/test_unique_network_flows.cpp
@MiguelCompany
Copy link
Copy Markdown
Collaborator

@MiguelCompany - I have rebased and addressed your comment. However, I'm still unable to get a successful build because of the issue I shared above: #872 (comment)

Don't worry about the build issue, the CI (which is manually launched) builds all the packages (i.e. no binary packages are used)

@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch 2 times, most recently from 181e5e2 to 1aeb4f7 Compare April 21, 2026 15:19
Copy link
Copy Markdown
Collaborator

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@fujitatomoya
Copy link
Copy Markdown
Collaborator

Pulls: #872
Gist: https://gist.githubusercontent.com/fujitatomoya/0b33e88646ff7ef2537377ce25f362c1/raw/30e78828e520f669597e1694145cfd1a38ce1593/ros2.repos
BUILD args: --packages-above-and-dependencies rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp rmw_fastrtps_shared_cpp
TEST args: --packages-above rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp rmw_fastrtps_shared_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19040

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

@MiguelCompany
Copy link
Copy Markdown
Collaborator

Manually rebuild with rmw_fastrtps_dynamic_cpp enabled

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

Comment thread rmw_fastrtps_shared_cpp/test/test_unique_network_flows.cpp Outdated
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 1aeb4f7 to 041f3c9 Compare April 22, 2026 13:15
thomasmoore-torc and others added 3 commits April 22, 2026 13:40
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 041f3c9 to 02d35e5 Compare April 22, 2026 13:40
@MiguelCompany
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Collaborator

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

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

We can always use rcutils_set_env, since its behavior is to always override.

Comment thread rmw_fastrtps_shared_cpp/test/test_unique_network_flows.cpp
Comment thread rmw_fastrtps_shared_cpp/test/test_unique_network_flows.cpp Outdated
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 7308ab6 to 7fbc3f8 Compare April 23, 2026 11:08
Copy link
Copy Markdown
Collaborator

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

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

LGTM with green CI

@MiguelCompany
Copy link
Copy Markdown
Collaborator

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

…WORK_FLOWS is an empty string

Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc thomasmoore-torc force-pushed the unique_network_flows_optional_checks branch from 2b78aec to 84ac6ac Compare April 25, 2026 16:04
@thomasmoore-torc
Copy link
Copy Markdown
Author

@MiguelCompany - hopefully the latest commit fixes the issues with the CI unit tests. I didn't realize that rcutils_get_env returns an empty string if the environment variable was set, so a warning was being emitted for all of the unit test, breaking those that expected certain output.

Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc
Copy link
Copy Markdown
Author

I also decided to use SYSTEM_DEFAULT instead of DEFAULT for the environment variable to avoid any confusion between the default for the ros_discovery_info topic being RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_OPTIONALLY_REQUIRED and whatever the system default is as provided by RMW_UNIQUE_NETWORK_FLOW_ENDPOINTS_SYSTEM_DEFAULT.

@MiguelCompany
Copy link
Copy Markdown
Collaborator

New (hopefully last) CI:

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

Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
Signed-off-by: Thomas Moore <thomas.moore@torc.ai>
@thomasmoore-torc
Copy link
Copy Markdown
Author

@MiguelCompany - while looking into the build issues, I decided to downgrade the warning to an info that was emitted when UNF was skipped while being set to optional because that is the expected behavior. I also added a test to verify that no unexpected logs were generated.

Regarding the build issues, it looks like all of the builds failed in the same way as the recent nightly builds. How should we handle this?

const char * error_str;
error_str = rcutils_get_env("RMW_FASTRTPS_ROS_DISCOVERY_INFO_UNIQUE_NETWORK_FLOWS", &env_value);
ASSERT_EQ(error_str, nullptr) << "Error getting env var: " << error_str;
value = (*env_value != '\0') ? std::optional<std::string>(env_value) : std::nullopt;
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.

Suggested change
value = (*env_value != '\0') ? std::optional<std::string>(env_value) : std::nullopt;
value = ((nullptr != env_value) && (*env_value != '\0')) ? std::optional<std::string>(env_value) : std::nullopt;

@MiguelCompany
Copy link
Copy Markdown
Collaborator

Regarding the build issues, it looks like all of the builds failed in the same way as the recent nightly builds. How should we handle this?

After approval, if we consider that test failures are unrelated to this PR, we could merge.

Note, however, that we are currently inside the freeze for Lyrical, and we would need to wait for the freeze to be released before merging.

@christophebedard
Copy link
Copy Markdown
Member

Pulls: #872
Gist: https://gist.githubusercontent.com/christophebedard/d85cf1e23c791636db5282c086230f5a/raw/30e78828e520f669597e1694145cfd1a38ce1593/ros2.repos
BUILD args: --packages-above-and-dependencies rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp rmw_fastrtps_shared_cpp
TEST args: --packages-above rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp rmw_fastrtps_shared_cpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19202

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

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.

4 participants