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

Altering liveliness lease_duration #755

Closed
wants to merge 3 commits into from

Conversation

CursedRock17
Copy link

This pull request is supposed to solve an issue noted in this RCUTILS pr in which a qos line undergoes an incorrect conversion. The original intent was to pass an int64_t and sacrifice some accuracy, but I don't believe it's possible due to our limited constructors for Duration_t. Instead, I converted to a nanosecond value, then operated on that value by making it 2/3s the original. Then, converting that value to a sec (double) which should fill the long double argument. We shouldn't need to operate on the sec (double), after having converted, because while our new version will have less accuracy, RCUTILS_NS_TO_S is undergoing changes to become more accurate.

rmw_fastrtps_shared_cpp/src/qos.cpp Outdated Show resolved Hide resolved
Copy link
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.

nit: title would be Altering liveliness lease_duration? announcement period sounds really different qos setting as domain participant, and that is not what we are changing here. (https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/general_disc_settings.html#discovery-lease-announ)

Co-authored-by: Chris Lalancette <[email protected]>
Signed-off-by: Lucas Wendland <[email protected]>
@CursedRock17 CursedRock17 changed the title Altering announcement_period Altering liveliness lease_duration May 3, 2024
@sloretz
Copy link
Contributor

sloretz commented May 10, 2024

@clalancette friendly ping 🧇

@ahcorde ahcorde requested a review from clalancette May 15, 2024 09:30
Comment on lines +144 to 145
int64_t period_in_ns = entity_qos.liveliness().lease_duration.to_ns() * 2 / 3;
double period_in_s = RCUTILS_NS_TO_S(period_in_ns);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just coming back to look at this again, and I'm realizing that these two lines together are wrong, at least, with the current implementation of RCUTILS_NS_TO_S.

The problem is in switching period_in_ns to an int64_t. Because RCUTILS_NS_TO_S currently uses longs in the divisor, then everything is an integer. So if you have less than 1 second (1000000000 ns), then we use integer division here and always end up with zero. That's likely why period_in_ns was a double to begin with, since everything will be promoted to a double.

If we put in ros2/rcutils#460 along with this one, then I guess that particular issue goes away. But this is making me much more nervous about ros2/rcutils#460 in general. While this macro isn't used very heavily, I think that will change the semantics enough that it is concerning. I'll leave a comment over there.

As far as this PR goes, I actually think that what is here is fine, at least for now. So I'm actually going to suggest that we close this PR out.

@cottsay cottsay added the question Further information is requested label Jul 18, 2024
@fujitatomoya
Copy link
Collaborator

@CursedRock17 #755 (comment) makes sense to me. do we close this one out?

@CursedRock17
Copy link
Author

Apologies, I wanted to go through solutions in rcutils before I came back here to clear up this pull request. Yeah we can go ahead and close this out. Though perhaps, way in the future, we may have to revisit if the MACRO behavior ends up changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants