-
Notifications
You must be signed in to change notification settings - Fork 680
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
[Blackboard] Deadlock on concurrent set() and getInput(). #367
Comments
Suggestion 2: Remove the https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/include/behaviortree_cpp_v3/blackboard.h#L90-L94 Then the blackboard interface is clean to its public API and any user of the Blackboard does not need to think about threading/data race issues. |
i think I like suggestion 2 more. Let me think about it. |
I think I encountered this when I updated to new Foxy distributed packages. Is there a way to include the fix into binary of |
Hello @facontidavide,
We found the following deadlock using
behaviortree_cpp
version 3.6.1.It deadlocks in the following case using the newly introduced
entry_mutex_
from 06a1f4c.Lets think about the following two concurrent threads:
Thread A calls
Blackboard::set()
Thread A locks
mutex_
Thread B calls
TreeNode::getInput()
Thread B locks
entry_mutex_
Thread A waits for
entry_mutex_
Thread B waits for
mutex_
The order of locking introduces the deadlock.
Mitigation:
In
Blackboard::set()
first lockentry_mutex_
then lockmutex_
.Thread A calls
Blackboard::set()
Thread A locks
entry_mutex_
Thread B calls
TreeNode::getInput()
Thread B waits for
entry_mutex_
Thread A locks
mutex_
Thread A releases
mutex_
andentry_mutex_
Thread B locks
entry_mutex_
Thread B locks
mutex_
Thread B releases
mutex_
andentry_mutex_
Thanks in advance!
The text was updated successfully, but these errors were encountered: