-
Notifications
You must be signed in to change notification settings - Fork 795
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
Pick smallest available participant ID for new paricipants #3437
Pick smallest available participant ID for new paricipants #3437
Conversation
@richiprosima please test this |
2dc0abf
to
f446ceb
Compare
@sloretz Reusing a participant ID within the same process is a bad idea, since it will allow for two participants to have the same GUID. I am developing a different way of achieving the expected behavior, where the ports used do not depend on the participantID, and we always try with the lowest possible port. |
@MiguelCompany I thought the ports being calculated from the participant ID was part of the RTPS standard. and https://www.omg.org/spec/DDSI-RTPS/2.3/PDF I see in 9.6.1.1 it says
It seems like it would be OK to reuse a participant ID as no two participants would have the same ID at the same time. If I understand correctly, wouldn't the same thing happen if participants were in different processes and someone were to stop and restart the last participant on a machine? If the GUID being reused is a problem, maybe a solution is to change how the participant GUID is generated? It looks like the standard is more flexible about that.
|
@richiprosima Please test this |
@sloretz On f6f9840c28ed4282a70b95bd32a052ab98a6d46a I added a small change that makes the GUID be different when creating the same participant ID twice. The idea is to use a counter on the high part of the ID that is used to generate the GUID. |
@richiprosima Please test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Miguel Company <[email protected]>
7160972
to
e4f0c60
Compare
Signed-off-by: Miguel Company <[email protected]>
e4f0c60
to
8850078
Compare
@richiprosima Please test this |
@EduPonz Would you mind reviewing this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I think the added members (data & functions) would benefit from some hpp documentation. The same goes for some of the not so straight forward code both around the reserved/used pattern (clever way of going around the full locking BTW), and around the get_id_for_prefix
function, which shows some nice out-of-the-box thinking 🤯 .
@Mergifyio backport 2.6.x |
✅ Backports have been created
|
* Pick smallest available participant ID for new paricipants Signed-off-by: Shane Loretz <[email protected]> * Fix style issues Signed-off-by: Shane Loretz <[email protected]> * Eliminate m_maxRTPSParticipantId Signed-off-by: Shane Loretz <[email protected]> * Clearer comments on rationale behind return value Signed-off-by: Shane Loretz <[email protected]> * static_cast to avoid warning on WIN32 Signed-off-by: Shane Loretz <[email protected]> * Use special participant id value for prefix creation. Signed-off-by: Miguel Company <[email protected]> * New reservation mechanism Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Miguel Company <[email protected]> (cherry picked from commit e46e875) # Conflicts: # src/cpp/rtps/RTPSDomain.cpp # src/cpp/rtps/RTPSDomainImpl.hpp
…4555) * Pick smallest available participant ID for new paricipants (#3437) * Pick smallest available participant ID for new paricipants Signed-off-by: Shane Loretz <[email protected]> * Fix style issues Signed-off-by: Shane Loretz <[email protected]> * Eliminate m_maxRTPSParticipantId Signed-off-by: Shane Loretz <[email protected]> * Clearer comments on rationale behind return value Signed-off-by: Shane Loretz <[email protected]> * static_cast to avoid warning on WIN32 Signed-off-by: Shane Loretz <[email protected]> * Use special participant id value for prefix creation. Signed-off-by: Miguel Company <[email protected]> * New reservation mechanism Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Shane Loretz <[email protected]> Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Miguel Company <[email protected]> (cherry picked from commit e46e875) # Conflicts: # src/cpp/rtps/RTPSDomain.cpp # src/cpp/rtps/RTPSDomainImpl.hpp * Refs #20120: Solve conflicts Signed-off-by: Jesus Perez <[email protected]> * Refs #20120: Fix wrong deleted return Signed-off-by: Jesus Perez <[email protected]> * Refs #20120: Uncrustify Signed-off-by: Jesus Perez <[email protected]> --------- Signed-off-by: Jesus Perez <[email protected]> Co-authored-by: Shane Loretz <[email protected]> Co-authored-by: Jesus Perez <[email protected]>
Picks the smallest available participant ID.
Description
This picks the smallest available participant ID when creating new participants.
This is necessary for the out of box discovery improvements in ROS 2: ros2/rmw_fastrtps#653
The issue with picking one greater than the maximum participant ID is that it's possible for the ID to increase well beyond the number of alive participants. For example, Participant A is created with 0, and B is created with 1. A is destroyed, and C is created. C takes ID 2 even though 0 is available and there are only two participants. When using unicast discovery this can cause participants to no longer be discoverable after the maximum ID climbs past
maxInititialPeersRange
. This is currently causing thetest_launch_ros
tests to fail with the change to unicast discovery by default.Assuming the change looks ok, would it be possible to backport this to the 2.10 branch (assuming that's the branch that will be used for ROS Iron)?
Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist