gazebosim / gazebo-classic

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

Segfault when deleting noisy camera #609

Closed osrf-migration closed 11 years ago

osrf-migration commented 11 years ago

Original report (archived issue) by Brian Gerkey (Bitbucket: Brian Gerkey, GitHub: gerkey).


Using the camera noise support from pull request #412, deleting a noisy camera causes a segfault. Backtrace below. Deleting a non-noisy camera doesn't have this problem. Must be something with the compositor chain resources.

#0  0x00007fffed8194a9 in glDeleteFramebuffersEXT () from /usr/lib/nvidia-current/libGL.so.1
#1  0x00007fffe02d6cc0 in Ogre::GLFrameBufferObject::~GLFrameBufferObject() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#2  0x00007fffe02d6172 in Ogre::GLFBORenderTexture::~GLFBORenderTexture() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#3  0x00007fffe02e36c4 in Ogre::GLTextureBuffer::~GLTextureBuffer() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#4  0x00007fffe02e3749 in Ogre::GLTextureBuffer::~GLTextureBuffer() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#5  0x00007ffff2d5676f in Ogre::SharedPtr<Ogre::HardwarePixelBuffer>::destroy (this=0x7fffe0fc6b68) at /usr/include/OGRE/OgreSharedPtr.h:232
#6  0x00007ffff2d58f25 in release (this=0x7fffe0fc6b68) at /usr/include/OGRE/OgreSharedPtr.h:218
#7  ~SharedPtr (this=0x7fffe0fc6b68, __in_chrg=<optimized out>) at /usr/include/OGRE/OgreSharedPtr.h:155
#8  Ogre::HardwarePixelBufferSharedPtr::~HardwarePixelBufferSharedPtr (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/include/OGRE/OgreHardwarePixelBuffer.h:195
#9  0x00007fffe02f4084 in Ogre::GLTexture::freeInternalResourcesImpl() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#10 0x00007fffeded5099 in Ogre::Texture::freeInternalResources() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#11 0x00007fffeddfebc8 in Ogre::Resource::unload() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#12 0x00007fffe02f47b5 in Ogre::GLTexture::~GLTexture() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#13 0x00007fffe02f4829 in Ogre::GLTexture::~GLTexture() () from /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
#14 0x00007fffedca0fff in ?? () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#15 0x00007fffedca1261 in ?? () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#16 0x00007fffedca6f5f in Ogre::CompositorInstance::freeResources(bool, bool) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#17 0x00007fffedca7112 in Ogre::CompositorInstance::~CompositorInstance() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#18 0x00007fffedca7229 in Ogre::CompositorInstance::~CompositorInstance() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#19 0x00007fffedca29a6 in Ogre::CompositorChain::removeAllCompositors() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#20 0x00007fffedca38e8 in Ogre::CompositorChain::destroyResources() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#21 0x00007fffeddfb04e in Ogre::RenderTarget::fireViewportRemoved(Ogre::Viewport*) () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#22 0x00007fffeddfaf21 in Ogre::RenderTarget::removeAllViewports() () from /usr/lib/x86_64-linux-gnu/libOgreMain.so.1.7.4
#23 0x00007ffff2d4b838 in gazebo::rendering::Camera::Fini (this=0x279caf0) at /home/gerkey/code/drc/gazebo/gazebo/rendering/Camera.cc:279
#24 0x00007ffff702c8ed in gazebo::sensors::CameraSensor::Fini (this=0x7fff80056d20) at /home/gerkey/code/drc/gazebo/gazebo/sensors/CameraSensor.cc:150
#25 0x00007ffff704e9a5 in gazebo::sensors::SensorManager::SensorContainer::RemoveSensor (this=0xd94a50, _name=...)
    at /home/gerkey/code/drc/gazebo/gazebo/sensors/SensorManager.cc:565
#26 0x00007ffff704eb26 in gazebo::sensors::SensorManager::RemoveSensor (this=0x7ffff75bb1e0, _name=...)
    at /home/gerkey/code/drc/gazebo/gazebo/sensors/SensorManager.cc:315
#27 0x00007ffff731d7dc in gazebo::physics::Link::Fini (this=0x7fff80055af0) at /home/gerkey/code/drc/gazebo/gazebo/physics/Link.cc:242
#28 0x00007ffff32f27b6 in gazebo::physics::ODELink::Fini (this=0x7fff80055af0) at /home/gerkey/code/drc/gazebo/gazebo/physics/ode/ODELink.cc:198
#29 0x00007ffff72e91ce in gazebo::physics::Base::Fini (this=0x7fff8001bcf0) at /home/gerkey/code/drc/gazebo/gazebo/physics/Base.cc:102
#30 0x00007ffff72f69aa in gazebo::physics::Entity::Fini (this=0x7fff8001bcf0) at /home/gerkey/code/drc/gazebo/gazebo/physics/Entity.cc:516
#31 0x00007ffff7330d92 in gazebo::physics::Model::Fini (this=0x7fff8001bcf0) at /home/gerkey/code/drc/gazebo/gazebo/physics/Model.cc:319
#32 0x00007ffff72eb3d8 in gazebo::physics::Base::RemoveChild (this=0xaa0ef0, _name=...) at /home/gerkey/code/drc/gazebo/gazebo/physics/Base.cc:252
#33 0x00007ffff7358477 in gazebo::physics::World::ProcessEntityMsgs (this=0x8743e0) at /home/gerkey/code/drc/gazebo/gazebo/physics/World.cc:1257
#34 0x00007ffff736377e in gazebo::physics::World::ProcessMessages (this=0x8743e0) at /home/gerkey/code/drc/gazebo/gazebo/physics/World.cc:1740
#35 0x00007ffff7363fd7 in gazebo::physics::World::Step (this=0x8743e0) at /home/gerkey/code/drc/gazebo/gazebo/physics/World.cc:500
#36 0x00007ffff7364ed8 in gazebo::physics::World::RunLoop (this=0x8743e0) at /home/gerkey/code/drc/gazebo/gazebo/physics/World.cc:353
#37 0x00007ffff5f42ce9 in thread_proxy () from /usr/lib/libboost_thread.so.1.46.1
#38 0x00007ffff6aace9a in start_thread (arg=0x7fff8affd700) at pthread_create.c:308
#39 0x00007ffff52ebcbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#40 0x0000000000000000 in ?? ()
osrf-migration commented 11 years ago

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


Looks like a threading issue. Ogre is not very thread safe and usually complains if resources are being created/deleted from a different thread. In this case, the compositor resources are being deleted from outside the main rendering thread.

I created a branch to verify this by moving the sensor removal call to the main update function. Deleting the camera here doesn't seem to crash here.

osrf-migration commented 11 years ago

Original comment by Brian Gerkey (Bitbucket: Brian Gerkey, GitHub: gerkey).


@iche033: awesome, thanks! I'll work with approach and merge it into camera_noise.

osrf-migration commented 11 years ago

Original comment by Brian Gerkey (Bitbucket: Brian Gerkey, GitHub: gerkey).


Merged delayed removal code from camera_noise_destroy to camera_noise and updated pull request #412

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).