Open osrf-migration opened 8 years ago
Original comment by William Woodall (Bitbucket: William Woodall, GitHub: wjwwood).
Also, I was going to select the version in the issue description, but 7.3 is not listed there.
% gazebo --version
Gazebo multi-robot simulator, version 7.3.1
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
Gazebo multi-robot simulator, version 7.3.1
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
Original report (archived issue) by William Woodall (Bitbucket: William Woodall, GitHub: wjwwood).
We have a custom plugin, which is currently a Sensor plugin, that:
See:
This will regularly trigger an assert in the
boost::shared_ptr
code, like this:I believe this is because the Sensor plugin is running in a separate thread from the physics loop, so when our code calls
this->world->GetEntity(collision)
, it ends up iterating over the children of the world object and in a separate thread we have a plugin that is spawning new models periodically into the world.My theory is that the
GetEntity
call ends up here:Where it is iterating over the world object's children using iterators. If in the other thread objects are being added to this same vector, then these iterators are probably becoming invalid, which eventually results in invalid iterators being interpreted as a boost shared pointer.
I think an appropriate response to this might be "sensor plugins are not thread safe with these calls; won't fix" and we're attempting to work around this now by redesigning the plugin in question to be a model plugin in order to avoid this issue. However, at @scpeters request, I'm opening this issue to keep track of it. Either there needs to be some high level documentation that mentions this thread non-safety and explains how the architecture of the different plugins affects what can be called from where. This documentation may exist, but I looked for a while and didn't find it (please point it out if I missed it).