-
Notifications
You must be signed in to change notification settings - Fork 227
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
Fix multi-threaded race condition in client.call_async #871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this makes sense to avoid the possible racy condition in theory.
@ivanpauno @jacobperron could you take a look at this when you have time? |
Tricky.. I suppose there are similar threading issues with the action client, wherever we are making service requests, for instance rclpy/rclpy/rclpy/action/client.py Line 435 in 289d7d3
has a race with rclpy/rclpy/rclpy/executors.py Line 383 in 7a906af
It's possible the executor tries to process a request before the future is available in the list. It's too bad we have to introduce a lock at the scope of sending the request, but I can't think of another way. Hopefully it won't have a significant impact to performance. @sloretz Thoughts? |
Yes this race condition definitely exists in the ActionClient. Actually, even #564 still exists there. The question is why is the Client functionality being reimplemented in ActionClient? Why not reuse the existing Client functionality by creating sub-clients to handle goal requests, cancel requests etc.? I guess this should be a new issue. |
👍, I'm not sure how easy is to do that but I think it would be good to reuse the existing client code.
Yes, I don't think we need to address that here. |
I think the Action Client doesn't share the same logic as the Client because it is using the |
Signed-off-by: augustelalande <auguste.lalande@gmail.com>
Signed-off-by: augustelalande <auguste.lalande@gmail.com>
Signed-off-by: augustelalande <auguste.lalande@gmail.com>
Signed-off-by: augustelalande <auguste.lalande@gmail.com>
Signed-off-by: augustelalande <auguste.lalande@gmail.com>
* fix multi-thread race condition in client.call (cherry picked from commit 301953d)
Proposal to fix multi-threaded race condition in client.call_async as described in #870