Repository navigation
Reuse the profile's transports with the LOCALHOST discovery range - #985
Open
fujitatomoya wants to merge 1 commit into
Open
fujitatomoya wants to merge 1 commit into
fujitatomoya wants to merge 1 commit into
Conversation
With ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST, a shared memory transport and a UDPv4 transport with maxInitialPeersRange = 32 were always added, even when the default XML profile already had transports of those kinds. The UDPv4 descriptor created in code could not be reached from the profile, so the only way to discover more than 32 participants on a host was to register a second UDPv4 transport, which sends every unicast datagram twice. Keep the UDPv4 and shared memory transports that are already in the default participant QoS, and only add the missing ones. A UDPv4 transport with a maxInitialPeersRange lower than 32 is raised to 32 on a copy of the descriptor, as it is shared with the loaded profiles. The behavior without user transports in the profile does not change. Fixes #984 Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST,rmw_fastrtpsalways appended a shared memory transport and a UDPv4 transport withmaxInitialPeersRange = 32, without looking at the transports the default XML profile had already put in the participant QoS. The UDPv4 descriptor was created in code after the profile was loaded, so the profile could not change it. The only way to discover more than 32 participants on a host was to register a second UDPv4 transport from the profile.This change keeps the UDPv4 and shared memory transports that are already in the default participant QoS, and only adds the ones that are missing:
maxInitialPeersRangelarger than 32 takes effect with a single transport.maxInitialPeersRangelower than 32 is raised to 32. Fast DDS defaults to 4, and a profile cannot say whether 4 was chosen or left at the default, so without this floor every profile with a plain UDPv4 transport would drop from 32 to 4 participants. The value is changed on a copy, because the descriptor object is shared with the loaded profiles and with other participants in the process.The README gets a short section on the 32-participant limit and how to raise it.
Fixes #984
Is this user-facing behavior change?
Yes, only with
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOSTand a default XML profile that has a UDPv4 or SHM transport inuserTransports(or usesbuiltinTransportsmodes such asLARGE_DATA, which filluserTransportswhen the XML is parsed).maxInitialPeersRangein the profile can raise the number of participants discovered on a host above 32.Nothing changes for the other discovery ranges, or without user transports in the profile.
Did you use Generative AI?
Yes, Claude Fable 5.2 (Claude Code). The change, the tests and this description were generated, and verified as described below.
Additional Information
Why the second transport was a problem. In Fast DDS every registered transport expands the initial peers (
NetworkFactory::configureInitialPeerLocator) and opens its own output channel (UDPTransportInterface::OpenOutputChannel), so with two UDPv4 transports every unicast datagram is sent twice.Measurements (Fast DDS 3.6.3, one
talkerand onelistener, UDP datagrams onloto the RTPS ports of the domain over 30 s, two runs each):rollingmaxInitialPeersRange64 (the workaround in #984)With the 64-peer profile the talker has one socket fewer (11 to 10), and with a profile that also has a SHM transport the two processes create 2 SHM segments, down from 4.
Reproducer from #984 (20 talker/listener pairs, 40 participants):
listener_16tolistener_19(same asrolling, the default stays 32)maxInitialPeersRange64useBuiltinTransportsfalsemaxInitialPeersRangelistener_16tolistener_19(raised from 4 to 32); none with 14 pairsTests.
test_localhost_transportscreates participants on top of a default participant QoS with user transports and checks the transports of the resulting participant. Three of the five tests fail onrolling.colcon test --packages-select rmw_fastrtps_cpp: 558 tests, 0 failures.Points for review
interfaceWhiteListis reused like any other. I checked that this is not a behavior change: with a whitelist that only has a non-loopback address, discovery with theLOCALHOSTrange fails onrollingas well, and with127.0.0.1it works on both.useBuiltinTransportsfalse with only UDPv4). That is the existing behavior and is not changed here.Signed-off-bytwice by mistake. It can be dropped in the squash message.🤖 Generated with Claude Code