Closed azeey closed 2 years ago
This segfault does not occur in
ign-gazebo6
. I'm not sure what changed betweenign-gazebo6
andmain
, but the only difference I can tell so far is inmain
,libGzSceneManager.so
is unloaded in when you exit beforeGuiRunner
is destroyed. Inign-gazebo6
, it never gets unloaded.
Is there any reason why libGzSceneManager.so
is unloaded in main
, but not on ign-gazebo6
? I guess one patch for this issue is to never unload libGzSceneManager.so
in main
, but I'm guessing we don't want to do that since that could technically result in memory leaks.
Environment
Description
GuiRunner
'sEventManager
object. I believe the cause for this is as follows:GuiRunner
'sEventManager
object containsignition::common::EventT
objects created by GUI plugins. Since these are templates, the vtable for the objects is stored in the shared library of the GUI plugin that creates theEventT
objects.event::SceneUpdate
is emitted inRenderUtil.cc
which is part oflibignition-gazebo7-rendering.so
. AndlibGzSceneManager.so
depends onlibignition-gazebo7-rendering.so
. Emitting that event creates theEventT
object which is stored inGuiRunner
'sEventManager
object, but thevtable
is stored inlibignition-gazebo7-rendering.so
.libGzSceneManager.so
is unloaded, which in turn unloadeslibignition-gazebo7-rendering.so
. This invalidates thevtable
for theevent::SceneUpdate
object contained inGuiRunner
'sEventManager
object.GuiRunner
'sEventManager
object to be destroyed, the virtual destructor for theevent::SceneUpdate
object is called, but since the pointer to the destructor points to an address that is no longer accessible, a segfault occurs.Other notes:
EventT
.ign-gazebo6
. I'm not sure what changed betweenign-gazebo6
andmain
, but the only difference I can tell so far is inmain
,libGzSceneManager.so
is unloaded in when you exit beforeGuiRunner
is destroyed. Inign-gazebo6
, it never gets unloaded.Steps to reproduce
ign gazebo empty.sdf
Output
Stack trace
``` #31 Object "/home/addisu/.rbenv/versions/2.5.1/lib/libruby.so.2.5", at 0x7f192f6eec78, in #30 Object "/home/addisu/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-linux/fiddle.so", at 0x7f192e01d8b4, in #29 Object "/home/addisu/.rbenv/versions/2.5.1/lib/libruby.so.2.5", at 0x7f192f6c3ee7, in rb_thread_call_without_gvl #28 Object "/home/addisu/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-linux/fiddle.so", at 0x7f192e01da77, in #27 Object "/usr/lib/x86_64-linux-gnu/libffi.so.6", at 0x7f192ddd171e, in ffi_call #26 Object "/usr/lib/x86_64-linux-gnu/libffi.so.6", at 0x7f192ddd1dad, in ffi_call_unix64 #25 Object "/home/addisu/ws/garden/install/lib/libignition-gazebo7-ign.so.7.0.0~pre1", at 0x7f192d0ff9d0, in runGui #24 Object "/home/addisu/ws/garden/install/lib/libignition-gazebo7-gui.so.7", at 0x7f192cd2eb39, in ignition::gazebo::v7::gui::runGui(int&, char**, char const*, char const*) #23 Object "/home/addisu/ws/garden/install/lib/libignition-gazebo7-gui.so.7", at 0x7f192cd30677, in std::unique_ptr