ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Ros2 Service Send Request Does Not Send

asked 2019-01-22 09:14:52 -0500

borgman_jeremy gravatar image

I have been debugging an issue that causes my program to deadlock. I created a minimal working example that replicates the behavior: https://github.com/borgmanJeremy/ros_...

This example uses ros2 services. The server manages a vector of ints. Clients can "register" new values, and the server will append these values to the vector. Clients can also query a position in the vector, and if the position exists, the server will return the value in that position.

The issue I have is that when starting with my launch file (ros2 launch ros_service_mwe mwe_service.launch.py) sometimes the client that is waiting for a value at particular position gets stuck in spin_until_future_complete(). I did some debugging with WireShark and it looks like the service request never makes it to the wire. This is tricky to troubleshoot as it fails ~1 in 10 times on my particular machine, but the failure rate changes depending on the machine.

The easiest way to detect this condition is to look at the terminal output and wait for an instance where the [getNode] does not print: [INFO] [getNode]: Value of Pos: 7

I can solve this issue by adding a timeout / retry strategy to the spin_until_future_complete() call, but I really don't understand the root cause of the issue and am afraid I will mask an issue that will manifest in the future.

I started this minimal example with the add_two_ints example, so the print_usage() function still matches that example.

This is running on the Crystal release of ROS2.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-11 07:31:30 -0500

borgman_jeremy gravatar image

This turned out to be a bug solved by building with the latest crystal release: https://github.com/ros2/rclcpp/issues...

edit flag offensive delete link more

Comments

1

+1 for posting an answer to your own question.

Could you please accept your own answer by clicking the checkmark?

That makes it much clearer that your question was answered. Closing a question only shows closed on the question listing.

gvdhoorn gravatar image gvdhoorn  ( 2019-02-11 08:43:14 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2019-01-22 09:14:52 -0500

Seen: 838 times

Last updated: Feb 11 '19