Skip to content

Refresh builtin endpoint locators when a known participant changes its metatraffic locators - #6670

Open
tauto1127 wants to merge 1 commit into
eProsima:masterfrom
tauto1127:fix/refresh-builtin-locators-on-locator-change
Open

tauto1127 wants to merge 1 commit into
eProsima:masterfrom
tauto1127:fix/refresh-builtin-locators-on-locator-change

Conversation

@tauto1127

Copy link
Copy Markdown

Description

A participant may change its IP address at run time while keeping its GUID, for example a mobile robot roaming
between networks, a device that gets a new DHCP lease, or a process that is checkpointed and restored on another
host. After such a change, Fast DDS keeps sending part of its discovery traffic to the old address of that
participant, as described below.

When a remote participant that has already been discovered keeps its GUID but announces different metatraffic
locators (for example, because its IP address changed), PDPListener updates the participant proxy data, but the
builtin endpoints that are already matched with it keep sending to the old locators:

  • The SPDP writer keeps sending unicast announcements to the old metatraffic locator.
  • With Simple EDP, the existing SEDP writer and reader proxies are not updated, so HEARTBEAT, DATA, and ACKNACK
    continue to be sent to the old locators. If SEDP DATA for a new endpoint of that participant is lost, it is not
    repaired, and the endpoint may not be discovered.

This PR covers the Simple discovery protocol (PDPSimple). Discovery Server clients and servers are not changed.

This PR adds PDPSimple::update_remote_builtin_locators(), called from PDPListener::process_alive_data() when the
metatraffic locators of a known participant change:

  • The SPDP writer updates the locators of the remote SPDP reader only if it is already matched. The SPDP writer is
    updated in the same way when Static EDP is used, and the static remote endpoints keep being reassigned on every
    update as before.
  • If the Simple EDP endpoints are already matched with that participant, they are matched again with
    assignRemoteEndpoints(pdata, false), which updates the existing proxies in place. Their reliability state is
    kept. The first matching is left to PDPSimple::assignRemoteEndpoints(), which runs after the user has been
    notified of the new participant and has had the chance to ignore it.
  • This refresh is skipped when the local participant has security enabled.

No virtual method is added, so the change is ABI compatible and can be backported.

OpenDDS handled a similar problem in OpenDDS/OpenDDS#1365, which both detects local network changes and updates
the transport to use the new locators for remote participants. This PR only covers the second part: following the
new locators announced by a known remote participant. Detecting local network changes is out of scope.
On the announcing side, when DomainParticipant::set_qos() is called, Fast DDS already recomputes the locators it
generated from the network interfaces, and re-announces them if they changed; this PR makes the receiving side
follow such announcements.
User endpoints already follow such changes through SEDP when the remote participant re-announces them with the new
locators; this PR lets the builtin SEDP endpoints keep exchanging that data with the new address.

Two regression tests are added in RTPSBlackboxTestsLocatorUpdates.cpp. In each one, a fake remote participant
announces a metatraffic locator, then announces a new one on another port while keeping its GUID. The local
participant uses the test UDP transport, and its locator filter checks that traffic goes to the new locator and no
longer to the old one:

  • RTPSLocatorUpdates.sedp_follows_participant_metatraffic_locator
  • RTPSLocatorUpdates.spdp_follows_participant_metatraffic_locator

The tests do not use fixed sleeps. Results with --gtest_repeat=10 (Release build on Ubuntu 22.04):

  • On master (5fffb06c3): 20/20 failures (both tests fail in every repetition).
  • With this PR: 20/20 passes, about 2.6 s per test.

Not covered by this PR

  • Discovery Server clients and servers (PDPClient, PDPServer).
  • Local participants with security enabled, including when they allow unauthenticated participants.
  • Detecting local network changes. The announcing side relies on the existing DomainParticipant::set_qos().
  • A locator change received while the first discovery of that participant is still being processed is overwritten
    by the first matching, which uses the locators it had copied earlier. This already happens on master; this PR only
    ensures that no Simple EDP match is created before the user has been notified of the new participant.

@Mergifyio backport 3.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • Any new/modified methods have been properly documented using Doxygen.
  • N/A Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
    • The only behavior change is that, when a known participant announces different metatraffic locators, the
      builtin endpoints already matched with it send to the new locators instead of the old ones.
  • Changes are API compatible.
  • N/A New feature has been added to the versions.md file (if applicable).
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

…s metatraffic locators

When a known remote participant keeps its GUID but announces different
metatraffic locators (for example, because its IP address changed), the
participant proxy data is updated, but the builtin endpoints already
matched with it keep sending to the old locators:

- The SPDP writer keeps sending unicast announcements to the old locator.
- With Simple EDP, the existing SEDP writer and reader proxies are not
  updated, so HEARTBEAT, DATA and ACKNACK keep going to the old locators.

Add PDPSimple::update_remote_builtin_locators(), called from
PDPListener::process_alive_data() when the metatraffic locators of a
known participant change:

- The SPDP writer updates the locators of the remote SPDP reader, only if
  it is already matched. This is also done with Static EDP.
- If the Simple EDP endpoints are already matched with that participant,
  they are matched again with assignRemoteEndpoints(pdata, false), which
  updates the existing proxies in place, keeping their reliability state.
  The first matching is left to PDPSimple::assignRemoteEndpoints(), after
  the new participant has been notified (and maybe ignored).
- This refresh is skipped when the local participant has security enabled.

Add two blackbox regression tests in RTPSBlackboxTestsLocatorUpdates.cpp.
A fake remote participant announces a new metatraffic locator on another
port, and the test transport's locator filter checks that SPDP and SEDP
traffic goes to the new locator and no longer to the old one.

Signed-off-by: Takuto Kajimura <tiharu717@gmail.com>
@tauto1127
tauto1127 marked this pull request as ready for review December 4, 2026 05:06

@MiguelCompany MiguelCompany left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AFAICT, the intended behavior of this PR shall be achieved through the code in lines 247-250:

        if (parent_pdp_->updateInfoMatchesEDP())
        {
            parent_pdp_->mp_EDP->assignRemoteEndpoints(*old_data, true);
        }

This branch has not been deployed

No deployments
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.

2 participants