Skip to content
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

Ensure all Clock accesses are thread-safe #999

Merged
merged 2 commits into from
Feb 28, 2020
Merged

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Feb 20, 2020

Precisely what the title says. Before this patch, both rclcpp::Clock and rclcpp::TimerBase (though indirectly through rcl) would access non thread-safe rcl_clock_* API without locking, leading to internal state corruption on concurrent access in multi-threaded applications.

This change is ABI breaking w.r.t. to previous distro releases (e.g. Eloquent) but sets the scene for future non ABI breaking changes using a PIMPL.

@hidmic hidmic changed the title Ensure all Clock accesses are thread-safe. Ensure all Clock accesses are thread-safe Feb 20, 2020
@dirk-thomas
Copy link
Member

It would be good to keep these two changes (PIMPL and adding a mutex) separate since together in a single commit it just makes the review harder.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Feb 21, 2020

@dirk-thomas fair enough, see a91ba82 and f4ff7f1.

clalancette added a commit that referenced this pull request Feb 21, 2020
This is an alternative PR to #999
The code in this one is less nice, but it is ABI-safe.  Thus,
it can be used as a short-term workaround for users hurt by
the problem now, and/or used as the solution for Eloquent.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside a nitpick looks good to me. Maybe merge without squashing to keep the two commits separate?

rclcpp/src/rclcpp/clock.cpp Outdated Show resolved Hide resolved
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Feb 21, 2020

CI up to rclcpp and test_rclcpp:

  • Linux Build Status
  • Linux-aarch64 Build Status (unrelated)
  • macOS Build Status (likely unrelated)
  • Windows Build Status (likely unrelated)

@hidmic
Copy link
Contributor Author

hidmic commented Feb 28, 2020

Alright, going in!

@hidmic hidmic merged commit 1644e92 into master Feb 28, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/clock-thread-safety branch February 28, 2020 12:44
clalancette added a commit that referenced this pull request Apr 9, 2020
This is an alternative PR to #999
The code in this one is less nice, but it is ABI-safe.  Thus,
it can be used as a short-term workaround for users hurt by
the problem now, and/or used as the solution for Eloquent.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
clalancette added a commit that referenced this pull request Apr 9, 2020
This is an alternative PR to #999
The code in this one is less nice, but it is ABI-safe.  Thus,
it can be used as a short-term workaround for users hurt by
the problem now, and/or used as the solution for Eloquent.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
clalancette added a commit that referenced this pull request Jun 16, 2020
This is an alternative PR to #999
The code in this one is less nice, but it is ABI-safe.  Thus,
it can be used as a short-term workaround for users hurt by
the problem now, and/or used as the solution for Eloquent.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
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.

3 participants