-
Notifications
You must be signed in to change notification settings - Fork 474
Store graph listener inside the context instead of the node graph (backport #2952) #2966
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
Conversation
|
Cherry-pick of 715a983 has failed: 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skyegalaxy do you mind to fix the conflicts ?
0759325 to
7106305
Compare
) * factor shutdown hook registration into its own method Signed-off-by: Skyler Medeiros <[email protected]> * run ament_uncrustify Signed-off-by: Skyler Medeiros <[email protected]> * consistent use of is_shutdown in graph-listener Signed-off-by: Skyler Medeiros <[email protected]> * this doesn't actually need to be a separate function Signed-off-by: Skyler Medeiros <[email protected]> * whitespace Signed-off-by: Skyler Medeiros <[email protected]> * fix typo Signed-off-by: Skyler Medeiros <[email protected]> * move graph listener into the context Signed-off-by: Skyler Medeiros <[email protected]> * make cpplint happy Signed-off-by: Skyler Medeiros <[email protected]> * Update rclcpp/src/rclcpp/context.cpp Signed-off-by: Skyler Medeiros <[email protected]> --------- Signed-off-by: Skyler Medeiros <[email protected]>
7106305 to
4303518
Compare
|
Pulls: #2966 |
|
This is ABI breaking and may not be backported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmachowinski thanks for letting me know that 👍
Description
This PR fixes a lock order inversion bug detected by Thread Sanitizer between
GraphListener::shutdown_mutex_andContext::on_shutdown_callbacks_mutex_, by storing and instantiating theGraphListenerinside of theContextinstead ofNodeGraph. With this change, we avoid locking the context weak pointer and inverting the order of lock acquisition on startup and shutdown.Usage of
is_shutdown_->load()was also replaced with the existingis_shutdown()method inGraphListenerfor consistency.Fixes # (2946)
Is this user-facing behavior change?
no
Did you use Generative AI?
no
Additional Information
This code appears to have remained unchanged for a long time, and I was able to reproduce this tsan error on iron, jazzy and rolling with this example. Tsan identified a lock order inversion as well as one potential data race in other parts of the code. With this change, the lock order inversion warning is gone, no additional tsan warnings were introduced, and all unit tests passed locally when these changes were built against both
jazzyandrolling.This is an automatic backport of pull request #2952 done by Mergify.