Skip to content

Ensure all Clock accesses are thread-safe#999

Merged
hidmic merged 2 commits intomasterfrom
hidmic/clock-thread-safety
Feb 28, 2020
Merged

Ensure all Clock accesses are thread-safe#999
hidmic merged 2 commits intomasterfrom
hidmic/clock-thread-safety

Conversation

@hidmic
Copy link
Copy Markdown
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
Copy Markdown
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 hidmic force-pushed the hidmic/clock-thread-safety branch from 2375505 to f4ff7f1 Compare February 21, 2020 14:07
@hidmic
Copy link
Copy Markdown
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
Copy Markdown
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?

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic force-pushed the hidmic/clock-thread-safety branch from f4ff7f1 to 79455ee Compare February 21, 2020 16:33
@hidmic
Copy link
Copy Markdown
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
Copy Markdown
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