-
Notifications
You must be signed in to change notification settings - Fork 527
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
Add timeout option to call_service messages #984
base: ros2
Are you sure you want to change the base?
Conversation
@@ -81,6 +81,7 @@ def call_service(self, message): | |||
fragment_size = message.get("fragment_size", None) | |||
compression = message.get("compression", "none") | |||
args = message.get("args", []) | |||
timeout = message.get("timeout", 5.0) |
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.
So the previous default was to never time out. Should this continue to be the case?
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.
If we want to retain current behavior, it should by default never timeout.
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.
Though I think we could change the defaults for rolling and future distros. @sea-bass what do you think about branching out for Jazzy ?
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.
I'm OK either way.
It would be the "right" thing to do to branch out for Jazzy, but I think we still have a few more months where it's okay to land breaking changes to Jazzy.
As an unofficial rule, I would say we can keep putting changes into Jazzy until May 2025 where you may see more people upgrading from ROS 1.
while rclpy.ok() and not future.done(): | ||
start_time = time.monotonic() | ||
while ( | ||
rclpy.ok() and not future.done() and time.monotonic() - start_time < server_response_timeout |
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.
Is there no option to never time out? Like a -1 value or something?
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.
We could treat any non-positive value as "no timeout"
Public API Changes
Adds
timeout
option tocall_service
messagesDescription
If during calling a service, the Service Server dies, the ServiceCaller will get stuck waiting for response. This also makes the whole protocol stuck if
call_services_in_new_threads
option is not set.This PR adds a response timeout parameter to ServiceCaller and adds an optional
timeout
option tocall_service
messages with a default value of 5 seconds.If the API change gets accepted I will finish this PR by adding tests that cover this feature