-
Notifications
You must be signed in to change notification settings - Fork 165
ServiceResponseHandler uses unsafe queue for returning service responses to caller #261
Comments
Hi @msmcconnell, thanks for reporting this. |
I have an integration test between two nodes where one of them is multi-threaded. I would need to remove a small dependency on my own code but it wouldn't be too hard. I can provide the code sample here. I'll try to think of a solution. |
Here is a code sample for an integration test I used to verify that this was happening.
Thread Class
The service used in this case looks like this.
|
Thanks @msmcconnell, this looks useful! |
I'll look into making a fix. Which branch is the preferred one to develop on? The README says master but it is listed as obsolete/master and the last PR was onto kinetic. Does that mean I should branch directly off kinetic? |
Good catch; that readme should be updated as well. |
The ServiceResponseHandler uses a queue to handler ros service requests between nodes. Since the response to a service call is simply a poll from the queue, service responses can become mismatched if a node contains multi-threaded components making the same service call. If the first request does not complete before the second request, the responses will be flipped. A mapping is needed to ensure only the correct responses are returned.
Relevant variable: Line 41
private final Queue<ServiceResponseListener<ResponseType>> responseListeners;
Relevant method: Line 52
The text was updated successfully, but these errors were encountered: