BehaviorTree/BehaviorTree.CPP

StatusChangeLogger is not thread safe

Closed this issue · 2 comments

Describe the bug
I encountered double free memory errors in the RosTopicLogger from Nav2 when using ThreadedAction nodes in my behavior tree.
I think the issue here is that the callback function of StatusChangeLogger gets called on each setStatus call and the ThreadedAction node calls setStatus from a different thread.
The concrete implementations of StatusChangeLogger are not aware that their implementation of callback might get called from different threads in parallel, so I think it would be best to prevent this from happening by adding a lock to the subscribeCallback.

Fixed!

Thanks for fixing this