Skip to content

[Foxy backport]: Make sure to lock the mutex protecting client_endpoints_. (#492)#493

Merged
jacobperron merged 1 commit intofoxyfrom
clalancette/foxy-backport-492
Dec 10, 2020
Merged

[Foxy backport]: Make sure to lock the mutex protecting client_endpoints_. (#492)#493
jacobperron merged 1 commit intofoxyfrom
clalancette/foxy-backport-492

Conversation

@clalancette
Copy link
Copy Markdown
Contributor

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

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.

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>
@clalancette
Copy link
Copy Markdown
Contributor Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jacobperron
Copy link
Copy Markdown
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.

@jacobperron jacobperron merged commit 8098a62 into foxy Dec 10, 2020
@delete-merged-branch delete-merged-branch bot deleted the clalancette/foxy-backport-492 branch December 10, 2020 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants