Ros2 Service Send Request Does Not Send #625
Labels
duplicate
This issue or pull request already exists
more-information-needed
Further information is required
Bug report
Required Info:
ros2.repos:
-Fast-RTPS
-rclcpp
Steps to reproduce issue
I initially posted this on ROS answers: https://answers.ros.org/question/313378/ros2-service-send-request-does-not-send/
But after digging into it some more I have become fairly convinced this is a bug.
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.
Here is a link to the MWE: https://github.com/borgmanJeremy/ros_service_mwe
Expected behavior
The expected behavior is that spin_until_future_complete() will return once the server is available to handle the callback.
Actual behavior
The actual behavior is spin_until_future_complete() never returns
Additional Info:
This might be related to this question? #455
The text was updated successfully, but these errors were encountered: