gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.19k stars 481 forks source link

Deleting Objects using World::RemoveModel(...) causes gazebo to crash #2434

Open osrf-migration opened 6 years ago

osrf-migration commented 6 years ago

Original report (archived issue) by Jorge Nicho (Bitbucket: jrgnicho).


Hello,

We have an application where we periodically spawn objects on a moving conveyor and then delete them after the objects go past a certain virtual wall in the workcell. However, after just a few of minutes of running the application the gazebo simulator crashes with the following error message:

[Dbg] [ObjectDisposalPlugin.cc:111] [deletion_wall] Removing model: object_19
gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:648: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::physics::SurfaceParams; typename boost::detail::sp_member_access<T>::type = gazebo::physics::SurfaceParams*]: Assertion `px != 0' failed.

I suspect that some sort of race condition is taking place when we call the RemoveModel(...) method. The issue can be reproduced by following the README instructions on the object-deletion-crashes-gazebo branch

Thank you

osrf-migration commented 6 years ago

Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).


Hi @jrgnicho, Thanks for reporting the issue. Would you mind posting the output of gazebo --version?

osrf-migration commented 6 years ago

Original comment by Jorge Nicho (Bitbucket: jrgnicho).


Yes, I forgot to do that on my original post

Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
osrf-migration commented 6 years ago

Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).


@jrgnicho would you mind checking if the issue also occurs with gazebo 7.11.0 from packages.osrfoundation.org?

osrf-migration commented 6 years ago

Original comment by Jorge Nicho (Bitbucket: jrgnicho).


@sloretz I'll give that a shot and get back with you, thanks.

osrf-migration commented 6 years ago

Original comment by Jorge Nicho (Bitbucket: jrgnicho).


@sloretz I upgraded to gazebo 7.11 and the crash did occur once again

[Dbg] [ObjectDisposalPlugin.cc:111] [deletion_wall] Removing model: object_19
gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:648: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::physics::SurfaceParams; typename boost::detail::sp_member_access<T>::type = gazebo::physics::SurfaceParams*]: Assertion `px != 0' failed.

This is what I now get from running gazebo --version

Gazebo multi-robot simulator, version 7.11.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
osrf-migration commented 6 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


@jrgnicho thanks for the bug report. I have seen crashes during World::RemoveModel in the past, and I've had the most success in diagnosing the problem when I can get a backtrace. I have ulimit -c unlimited in my bash profile, and this lets me catch core files after a gazebo crash. I think sometimes these are saved in the ~/.ros folder when using gazebo_ros?

Once I have a core file, I run gdb gzserver /path/to/core and then bt and thread apply all bt, which shows the backtraces. Let me know if you have any questions about this process.

osrf-migration commented 6 years ago

Original comment by Jorge Nicho (Bitbucket: jrgnicho).


@scpeters I'll inspect my system using your guidelines and report my findings.