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

Add timeout option to call_service messages #984

Merged
merged 12 commits into from
Jan 20, 2025
Merged

Conversation

bjsowa
Copy link
Collaborator

@bjsowa bjsowa commented Dec 22, 2024

Public API Changes
Adds timeout option to call_service messages

Description
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 to call_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

@bjsowa bjsowa requested a review from sea-bass December 22, 2024 09:30
@bjsowa bjsowa marked this pull request as ready for review January 20, 2025 14:59
@bjsowa bjsowa requested a review from sea-bass January 20, 2025 15:07
Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

I just have one question about what the default timeout should be -- for compatibility with the previous implementation, should it be a non-positive number for indefinite wait?

@@ -50,6 +58,12 @@ def setUp(self):
self.trigger_cb,
callback_group=self.cb_group,
)
self.trigger_long_srv = self.node.create_service(
Trigger,
self.node.get_name() + "/trigger_long",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just do "trigger_long" without the leading slash to get the same effect here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean without the node name as well? Like that

Suggested change
self.node.get_name() + "/trigger_long",
"trigger_long",

@@ -178,6 +178,10 @@ def protocol_parameter_handling(self):
"call_services_in_new_thread", False
).value

RosbridgeWebSocket.default_call_service_timeout = self.declare_parameter(
"default_call_service_timeout", 5.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the default be 5.0 or indefinite wait?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The plan is to make it 5 seconds from Jazzy onward and indefinite when backporting it to Humble

Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

Wait, we already had this discussion about default timeout -- sorry, I'll approve.

@bjsowa bjsowa merged commit 673fc05 into ros2 Jan 20, 2025
6 checks passed
@bjsowa bjsowa deleted the feature/client_timeout branch January 20, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants