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
avoid using dds common public mutex directly #725
avoid using dds common public mutex directly #725
Conversation
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
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.
I am okay with current fix, probably easier to backport.
I would like 2nd review on this. @clalancette can you check when you have time?
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.
I'm not a huge fan of doing these locks and unlocks by hand. It seems brittle, and I don't think it actually fixes the underlying problem.
In particular, I think that the lock sequence in rmw_create_subscription
is still going to have lock inversion problems with other pieces of code. Looking at it closer, I think what we may need to do here is to make it so that we always take the entity_creation_mutex
(and hold it), then take the node_update_mutex
. And do this in all codepaths.
Alternatively, we could consider moving the node_update_context
locking into rmw_dds_common::Context
, marking it private, and then removing the locking from here. That seems like a better idea anyway.
Thoughts?
Thanks. I think it's a good idea. I'll use this method even though it refactors more code. These repositories (rmw_dds_common, rmw_fastrtps, rmw_cyclonedds, rmw_connextdds) need to be updated. |
This reverts commit cd368d9. Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
It depends on ros2/rmw_dds_common#73 |
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
CI: |
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
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.
LGTM. Thanks @iuhilnehc-ynos
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.
I've left one thing that might improve this. Otherwise, this looks like a great fix.
rmw_ret = rmw_fastrtps_shared_cpp::destroy_publisher( | ||
eprosima_fastrtps_identifier, participant_info, publisher); |
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.
I almost feel like we should make this an RCPPUTILS_SCOPE_EXIT
right after we successfully create the publisher above. That way it will be destroyed in all error paths. Thoughts?
(the same goes for the subscription and the dynamic
versions below)
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
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.
lgtm with minor comments.
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
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.
Looks good to me with green CI.
to address one warning TSAN about
lock-order-inversion
mentioned at ros2/ros2#1488 (comment).TSAN warning log