-
Notifications
You must be signed in to change notification settings - Fork 227
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
Fix bad rmw_time_t to nanoseconds conversion. #555
Conversation
Signed-off-by: Michel Hidalgo <[email protected]>
FYI @emersonknapp. |
I don't think I have the necessary context for a meaningful review. It seems wrong to me to just map "invalid" input to some value without any warning / error.
Why can't the rmw API not be forced to set reasonable values in these cases? |
We can certainly add a warning if overflow would ensue, though that'll add noise for RMWs that can potentially return garbage.
I believe there's no consensus as to what would be a reasonable value in some cases. There're some who even think that In any case, this patch is still necessary. |
Makes sense to guard against overflow to me, since we're casting from uint64_t to int64_t. |
Imo that is simply unacceptable API. Do RMW implementations actually return uninitialized data? If yes, this might open us up to undefined which we should really avoid. |
I don't think that they return unitialized values, but we don't currently have a defined constant. fastrtps and connext return one value for "unspecified", and cyclone has some whole other constant that it seems to use for that value. ros2/rmw#210 is an attempt to discuss some ROS2-global constants that we would dictate in the API and expect rmw implementations to use. |
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.
Instead of working around the problem here the RMW implementations should be updated to return a defined value.
The only logic which should be present here is to check valid boundaries and show an error / raise an exception when that is violated.
That's not exactly true. Graph cache in
Which value? I don't have a strong opinion against zero initialization though.
This patch is orthogonal to that change.
We can raise an exception if the |
Signed-off-by: Michel Hidalgo <[email protected]>
See ros2/rmw_connext#422 and 0ef805b. It's not a silver bullet for the |
I don't have it up and running in front of me right now, but I was seeing (from ros2/rosbag2#335 (comment)) FastRTPS seems to always return the following when a QoS policy duration was unspecified (e.g. {0, 0} passed in)
Cyclone seems to always return the following when a QoS policy duration was unspecified (e.g. {0, 0} passed in) maybe this was an uninitialized value
|
Signed-off-by: Michel Hidalgo <[email protected]>
How about an alternative: construct the Python |
Signed-off-by: Michel Hidalgo <[email protected]>
@dirk-thomas PTAL |
Does something need to be changed in this function? |
@dirk-thomas No need to. |
Fixes ros2/ros2cli#503 (i.e. the failure, not the hang).
rmw_time_t
instances were being forced into anrcutils_time_duration_t
value (actually, first into a singleuint64_t
total nanosecond count, then into an unsignedPY_LONG_LONG
, and then into anrcutils_time_duration_t
i.e. anint64_t
), causing overflows.This happened in the first place because, RMW graph APIs are not currently bound to return anything reasonable for QoS related durations that do not make sense in a given context. That is the case for data reader (subscribers' backbone) lifespans in
rmw_connext_cpp
(see here and here), which come with whatever value was in the stack at the moment thatrmw_qos_profile_t
variable enters scope.I see there's some discussion in ros2/rmw#210 about introducing some consistency in
rmw_time_t
values. I'll defer to them on what to do about RMWs in general.