Ask Your Question

Ros2 Service Send Request Does Not Send

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

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:

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 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

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

borgman_jeremy gravatar image

This turned out to be a bug solved by building with the latest crystal release:

edit flag offensive delete link more



+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 imagegvdhoorn ( 2019-02-11 08:43:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



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

Seen: 84 times

Last updated: Feb 11