Repository navigation
[moveit_ros] fix race condition when stopping trajectory execution - #3198
Conversation
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3198 +/- ##
==========================================
+ Coverage 45.66% 46.01% +0.35%
==========================================
Files 714 714
Lines 62296 62320 +24
Branches 7530 7532 +2
==========================================
+ Hits 28444 28673 +229
+ Misses 33686 33481 -205
Partials 166 166 ☔ View full report in Codecov by Sentry. |
a57e9a4 to
87ee059
Compare
sjahr
left a comment
There was a problem hiding this comment.
Thanks, once the remaining comment is addressed and the PR that updates the deprecated headers is merged I think this is good to go
rhaschke
left a comment
There was a problem hiding this comment.
We might avoid introducing a new mutex and reuse execution_state_mutex_.
In all locations calling clear(), the flag execution_complete_ is True:
TrajectoryExecutionManager::stopExecutionTrajectoryExecutionManager::execute:execution_complete_is still true when callingclear()TrajectoryExecutionManager::executeThread
However, currently clear() is a public method. Thus, calling it directly will face the race condition.
I suggest changing its visibility to protected or even private.
5a59998 to
174357c
Compare
sea-bass
left a comment
There was a problem hiding this comment.
This looks really clean now -- as long as this still fixes your tests, looks great to me. Thanks!
rhaschke
left a comment
There was a problem hiding this comment.
If you follow my suggestion #3198 (review), you should also change visibility of clear() to protected or private!
Also, as a safe-guard for future changes, you should add an assertion to clear(), e.g. performing the following change to the line:
- RCLCPP_ERROR(logger_, "Cannot push a new trajectory while another is being executed");
+ RCLCPP_FATAL(logger_, "Expecting execution_complete_ to be true!");10c7e2a to
5a8e054
Compare
Hi @rhaschke, But I have concern for changing visibility of |
|
All these calls to |
Hi I opened a new pr #3226 for this |
Pull Request is not mergeable
…oveit#3198) Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
…oveit#3198) Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
* Fix race condition when stopping trajectory execution backport of moveit/moveit2#3198 * Move TrajectoryExecutionManager::clear() to private backport of moveit/moveit2#3226
…oveit#3198) Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
Description
It is not thread-safe calling
stopExecutionor publishing a"stop"totrajectory_execution_eventwhile trajectory executing. Sometimes it crashes, here's a sampleThis CL introduces a lock for interactions with
trajectories_and can fix this issue.Checklist