Ros2 Service Send Request Does Not Send
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.