[Foxy backport]: Make sure to lock the mutex protecting client_endpoints_. (#492)#493
Merged
jacobperron merged 1 commit intofoxyfrom Dec 10, 2020
Merged
Conversation
There were actually 2 problems here: 1. We were missing the lock in check_for_subscription() completely (this is the original issue that caused me to examine this code). 2. We had an accessor for clients_endpoints_ so that external users could get a reference. But with that being the case, any access to the returned reference would be without a lock. Since we were only accessing client_endpoints_ in two places, make some methods in ServicePubListener to do the requested operations while holding the lock, getting rid of the problem. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Contributor
Author
jacobperron
approved these changes
Dec 9, 2020
Member
|
I'm pretty sure the macOS and Windows test failures are pre-existing. I'm going ahead and merging this before making new release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were actually 2 problems here:
completely (this is the original issue that caused me to
examine this code).
users could get a reference. But with that being the case,
any access to the returned reference would be without a lock.
Since we were only accessing client_endpoints_ in two places,
make some methods in ServicePubListener to do the requested
operations while holding the lock, getting rid of the problem.
Signed-off-by: Chris Lalancette clalancette@openrobotics.org
Note that the patch here is slightly different than the one on master, since I had to take into account the ABI-compatible differences. Like I did with master, I'm going to run a full CI on this.