ros-controls / ros2_control

Generic and simple controls framework for ROS 2
https://control.ros.org
Apache License 2.0
433 stars 272 forks source link

Add resources_lock_ lock_guards to avoid race condition when loading robot_description through topic (backport #1451) #1600

Open mergify[bot] opened 6 days ago

mergify[bot] commented 6 days ago

As reported in #1442, loading the robot_description through the topic will cause a segmentation fault or some undefined behaviors as the read and write methods real-time methods are continuously executed, and when the robot description is received and the resource_manager is to be initialized, there is no lock_guard of recursive mutex resources_lock_, which should avoid the RM to execute the components when they are changing state or being loaded and initialized

Fixes #1442


This is an automatic backport of pull request #1451 done by Mergify.

mergify[bot] commented 6 days ago

Cherry-pick of 25f2c97eb909c48b96384c7cff7f7f36be8ca509 has failed:

On branch mergify/bp/iron/pr-1451
Your branch is up to date with 'origin/iron'.

You are currently cherry-picking commit 25f2c97.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   hardware_interface/src/resource_manager.cpp

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally