Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault in purgeGraveyardOfMetaobjects #8

Closed
dgossow opened this issue Jan 16, 2013 · 11 comments
Closed

segfault in purgeGraveyardOfMetaobjects #8

dgossow opened this issue Jan 16, 2013 · 11 comments

Comments

@dgossow
Copy link

dgossow commented Jan 16, 2013

This happens when I add a camera display in rviz.

rviz: 0f71e032dbe5310e78054cb0f7b10c62aa2ac4df
pluginlib: f684438
#0 0x00007ffff45405c0 in class_loader::class_loader_private::purgeGraveyardOfMetaobjects(std::string const&, class_loader::ClassLoader*, bool) () from /opt/ros/groovy/lib/libclass_loader.so
#1 0x00007ffff4542e50 in class_loader::class_loader_private::loadLibrary(std::string const&, class_loader::ClassLoader*) ()

from /opt/ros/groovy/lib/libclass_loader.so
#2 0x00007ffff453f216 in class_loader::ClassLoader::loadLibrary() () from /opt/ros/groovy/lib/libclass_loader.so
#3 0x00007ffff453f3b8 in class_loader::ClassLoader::ClassLoader(std::string const&, bool) () from /opt/ros/groovy/lib/libclass_loader.so
#4 0x00007ffff4545dd0 in class_loader::MultiLibraryClassLoader::loadLibrary(std::string const&) ()

from /opt/ros/groovy/lib/libclass_loader.so
#5 0x00007ffff7ae2480 in pluginlib::ClassLoader<image_transport::SubscriberPlugin>::loadLibraryForClass (this=0x7fffffffc230,

lookup_name=...) at /wg/stor5/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:484

#6 0x00007ffff7aeb07c in pluginlib::ClassLoader<image_transport::SubscriberPlugin>::createInstance (this=0x7fffffffc230,

lookup_name=...) at /wg/stor5/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:125

#7 0x00007ffff7adb840 in rviz::ImageDisplayBase::scanForTransportSubscriberPlugins (this=0x1ef6520)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/image/image_display_base.cpp:188

#8 0x00007ffff7adc001 in rviz::ImageDisplayBase::ImageDisplayBase (this=0x1ef6520)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/image/image_display_base.cpp:71

#9 0x00007fffac3fd8e9 in rviz::CameraDisplay::CameraDisplay (this=0x1ef6520)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/default_plugin/camera_display.cpp:85

#10 0x00007fffac4061ea in class_loader::class_loader_private::MetaObject<rviz::CameraDisplay, rviz::Display>::create (

this=<optimized out>) at /opt/ros/groovy/include/class_loader/meta_object.h:210

#11 0x00007ffff7ac8393 in class_loader::class_loader_private::createInstancerviz::Display (derived_class_name=..., loader=0x17cd670)

at /opt/ros/groovy/include/class_loader/class_loader_core.h:211

#12 0x00007ffff7ac86cf in createUnmanagedInstancerviz::Display (derived_class_name=..., this=0x17cd670)

at /opt/ros/groovy/include/class_loader/class_loader.h:115

#13 class_loader::MultiLibraryClassLoader::createUnmanagedInstancerviz::Display (this=, class_name=...)

at /opt/ros/groovy/include/class_loader/multi_library_class_loader.h:117

#14 0x00007ffff7ac884c in pluginlib::ClassLoaderrviz::Display::createUnmanagedInstance (this=0x2c1b1c0, lookup_name=...)

at /wg/stor5/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:160

#15 0x00007ffff7ac8fe2 in rviz::PluginlibFactoryrviz::Display::makeRaw (this=0x2b9f250, class_id=..., error_return=0x7fffffffc920)

at /opt/ros/groovy/include/rviz/pluginlib_factory.h:170

#16 0x00007ffff7abeb43 in rviz::DisplayFactory::makeRaw (this=0x2b9f250, class_id=..., error_return=)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/display_factory.cpp:50

#17 0x00007ffff7abfd24 in rviz::ClassIdRecordingFactoryrviz::Display::make (this=0x2b9f250, class_id=..., error_return=)

at /opt/ros/groovy/include/rviz/class_id_recording_factory.h:57

#18 0x00007ffff7acb976 in rviz::DisplayGroup::createDisplay (this=, class_id=...)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/display_group.cpp:120

#19 0x00007ffff7b6440d in rviz::VisualizationManager::createDisplay (this=0x2b53630, class_lookup_name=..., name=..., enabled=true)

at /wg/stor5/dgossow/wsrviz/src/rviz/src/rviz/visualization_manager.cpp:479

#20 0x00007ffff7acdb24 in rviz::DisplaysPanel::onNewDisplay (this=0x2c95c00)

@dgossow
Copy link
Author

dgossow commented Jan 16, 2013

(also happens for depthcloud and image)

@dgossow dgossow closed this as completed Jan 16, 2013
@dgossow dgossow reopened this Jan 16, 2013
@dgossow
Copy link
Author

dgossow commented Jan 16, 2013

This is what class_loader does:

[ INFO] /rviz_1358299800181619123: class_loader::class_loader_private: Also destroying metaobject 0x34301c0 (class = compressed_depth_image_transport::CompressedDepthPublisher, base_class = image_transport::PublisherPlugin, library_path = /opt/ros/groovy/lib//libcompressed_depth_image_transport.so) in addition to purging it from graveyard.

@dgossow
Copy link
Author

dgossow commented Jan 16, 2013

Here's again a backtrace with line numbers, plus some warnings:

[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: class_loader::ClassLoader: An attempt is being made to create a managed plugin instance (i.e. boost::shared_ptr), however an unmanaged instance was created within this process address space. This means libraries for the managed instances will not be shutdown automatically on final plugin destruction if on demand (lazy) loading/unloading mode is used.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: class_loader::ClassLoader: An attempt is being made to create a managed plugin instance (i.e. boost::shared_ptr), however an unmanaged instance was created within this process address space. This means libraries for the managed instances will not be shutdown automatically on final plugin destruction if on demand (lazy) loading/unloading mode is used.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: class_loader::ClassLoader: An attempt is being made to create a managed plugin instance (i.e. boost::shared_ptr), however an unmanaged instance was created within this process address space. This means libraries for the managed instances will not be shutdown automatically on final plugin destruction if on demand (lazy) loading/unloading mode is used.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: class_loader::ClassLoader: An attempt is being made to create a managed plugin instance (i.e. boost::shared_ptr), however an unmanaged instance was created within this process address space. This means libraries for the managed instances will not be shutdown automatically on final plugin destruction if on demand (lazy) loading/unloading mode is used.
[Thread 0x7fffd6f75700 (LWP 1471) exited]
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: pluginlib WARNING: PLUGINLIB_DECLARE_CLASS is deprecated, please use PLUGINLIB_EXPORT_CLASS instead. You can run the script 'plugin_macro_update' provided with pluginlib in your package source folder to automatically and recursively update legacy macros.
[ INFO] /rviz_1358299911399768852: class_loader::class_loader_private: Also destroying metaobject 0x2bb5810 (class = compressed_depth_image_transport::CompressedDepthPublisher, base_class = image_transport::PublisherPlugin, library_path = /opt/ros/groovy/lib//libcompressed_depth_image_transport.so) in addition to purging it from graveyard.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb)
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff45339cc in class_loader::class_loader_private::purgeGraveyardOfMetaobjects (library_path=..., loader=0x8ae7430,
delete_objs=true) at /u/dgossow/wsrviz/src/class_loader/src/class_loader_core.cpp:406
#2 0x00007ffff4533da8 in class_loader::class_loader_private::loadLibrary (library_path=..., loader=0x8ae7430)
at /u/dgossow/wsrviz/src/class_loader/src/class_loader_core.cpp:471
#3 0x00007ffff4530575 in class_loader::ClassLoader::loadLibrary (this=0x8ae7430)
at /u/dgossow/wsrviz/src/class_loader/src/class_loader.cpp:73
#4 0x00007ffff4530304 in class_loader::ClassLoader::ClassLoader (this=0x8ae7430, library_path=..., ondemand_load_unload=false)
at /u/dgossow/wsrviz/src/class_loader/src/class_loader.cpp:50
#5 0x00007ffff453e074 in class_loader::MultiLibraryClassLoader::loadLibrary (this=0x7fffffffc250, library_path=...)
at /u/dgossow/wsrviz/src/class_loader/src/multi_library_class_loader.cpp:81
#6 0x00007ffff7ae2480 in pluginlib::ClassLoader<image_transport::SubscriberPlugin>::loadLibraryForClass (this=0x7fffffffc200,
lookup_name=...) at /u/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:484
#7 0x00007ffff7aeb0ac in pluginlib::ClassLoader<image_transport::SubscriberPlugin>::createInstance (this=0x7fffffffc200,
lookup_name=...) at /u/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:125
#8 0x00007fffb0419ed0 in rviz::DepthCloudDisplay::scanForTransportSubscriberPlugins (this=0x8abbf20)
at /u/dgossow/wsrviz/src/rviz/src/rviz/default_plugin/depth_cloud_display.cpp:618
#9 0x00007fffb041ab65 in rviz::DepthCloudDisplay::DepthCloudDisplay (this=0x8abbf20)
at /u/dgossow/wsrviz/src/rviz/src/rviz/default_plugin/depth_cloud_display.cpp:126
#10 0x00007fffb043017a in class_loader::class_loader_private::MetaObject<rviz::DepthCloudDisplay, rviz::Display>::create (
this=) at /u/dgossow/wsrviz/src/class_loader/include/class_loader/meta_object.h:200
#11 0x00007ffff7ac8313 in class_loader::class_loader_private::createInstancerviz::Display (derived_class_name=..., loader=0x19c80b0)
at /u/dgossow/wsrviz/src/class_loader/include/class_loader/class_loader_core.h:211
#12 0x00007ffff7ac8659 in createUnmanagedInstancerviz::Display (derived_class_name=..., this=0x19c80b0)
at /u/dgossow/wsrviz/src/class_loader/include/class_loader/class_loader.h:118
#13 class_loader::MultiLibraryClassLoader::createUnmanagedInstancerviz::Display (this=, class_name=...)
at /u/dgossow/wsrviz/src/class_loader/include/class_loader/multi_library_class_loader.h:117
#14 0x00007ffff7ac87cc in pluginlib::ClassLoaderrviz::Display::createUnmanagedInstance (this=0x17e62c0, lookup_name=...)
at /u/dgossow/wsrviz/src/pluginlib/include/pluginlib/class_loader_imp.h:160
#15 0x00007ffff7ac8f62 in rviz::PluginlibFactoryrviz::Display::makeRaw (this=0x2ba9350, class_id=..., error_return=0x7fffffffc920)
at /opt/ros/groovy/include/rviz/pluginlib_factory.h:170
#16 0x00007ffff7abeac3 in rviz::DisplayFactory::makeRaw (this=0x2ba9350, class_id=..., error_return=)
at /u/dgossow/wsrviz/src/rviz/src/rviz/display_factory.cpp:50
#17 0x00007ffff7abfca4 in rviz::ClassIdRecordingFactoryrviz::Display::make (this=0x2ba9350, class_id=...,
error_return=) at /opt/ros/groovy/include/rviz/class_id_recording_factory.h:57
#18 0x00007ffff7acb8f6 in rviz::DisplayGroup::createDisplay (this=, class_id=...)
at /u/dgossow/wsrviz/src/rviz/src/rviz/display_group.cpp:120
#19 0x00007ffff7b6454d in rviz::VisualizationManager::createDisplay (this=0x98d680, class_lookup_name=..., name=..., enabled=true)
---Type to continue, or q to quit---
at /u/dgossow/wsrviz/src/rviz/src/rviz/visualization_manager.cpp:479
#20 0x00007ffff7acdaa4 in rviz::DisplaysPanel::onNewDisplay (this=0x2c9f590)
at /u/dgossow/wsrviz/src/rviz/src/rviz/displays_panel.cpp:115
#21 0x00007ffff2ab5281 in QMetaObject::activate(QObject_, QMetaObject const_, int, void**) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#22 0x00007ffff7596c72 in QAbstractButton::clicked(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#23 0x00007ffff72d4a4e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#24 0x00007ffff72d5d8b in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#25 0x00007ffff72d5ffc in QAbstractButton::mouseReleaseEvent(QMouseEvent_) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007ffff6f57144 in QWidget::event(QEvent_) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#27 0x00007ffff6f06894 in QApplicationPrivate::notify_helper(QObject_, QEvent_) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#28 0x00007ffff6f0c0bf in QApplication::notify(QObject_, QEvent_) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#29 0x00007ffff2aa0e9c in QCoreApplication::notifyInternal(QObject_, QEvent_) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007ffff6f07862 in QApplicationPrivate::sendMouseEvent(QWidget_, QMouseEvent_, QWidget_, QWidget_, QWidget**, QPointer&, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#31 0x00007ffff6f86bf5 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#32 0x00007ffff6f85bae in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#33 0x00007ffff6faf0d2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#34 0x00007ffff1825d53 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007ffff18260a0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007ffff1826164 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007ffff2ad03bf in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#38 0x00007ffff6faed5e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#39 0x00007ffff2a9fc82 in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#40 0x00007ffff2a9fed7 in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#41 0x00007ffff2aa4f67 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#42 0x0000000000400aec in main (argc=1, argv=) at /u/dgossow/wsrviz/src/rviz/src/rviz/main.cpp:41

@mirzashah
Copy link
Member

Same as ros-visualization/rviz#559
Issue has been resolved with class_loader 0.1.24, still building on the farm...

@dgossow
Copy link
Author

dgossow commented Jan 16, 2013

I'm running everything from sources.

@mirzashah mirzashah reopened this Jan 16, 2013
@mirzashah
Copy link
Member

Interesting, let me try to recreate the issue

@dgossow
Copy link
Author

dgossow commented Jan 16, 2013

It's actually happening when I add the second Image/Camera/DepthCloud display.
I've got everything from sources:

dgossow@lex:~/wsrviz$ ls src
class_loader CMakeLists.txt image_common image_transport_plugins pluginlib rviz

@mirzashah
Copy link
Member

Strange, I'm exhibiting this behavior too. I had fixed this problem...the only difference is that I was running debug code. Argh, back to the drawing board.

@mirzashah
Copy link
Member

Fixed with class_loader 0.1.25 (0375e760af6f42bc481c149a5754de58d3a52c86).

The problem was that the metaobject destructors were being defined in a header file. As metaobject.h is included by class_loader_core.h which is included by class_loader.h which is included by pluginlib/class_loader.h, this creates a definition of the destructor in both libclass_loader.so as well as the plugin library. This causes problems with graveyarding when you open a pure plugin library, close it, then reopen it again. On the second load, graveyard objects are being purged from the previous load. However, the destructor address that is linked is within the plugin library (e.g. libcompressedepthimagetransport.so). When the library is reloaded, the destructor address changes...the graveyarded objects expect the address from the first load. I've removed the deconstructors from the header file to guarantee the version used is always within libclass_loader.so.

I was not able to confirm this as it seems C++ does not let you get a pointer to the destructor for a class. However, my fix alleviates the problem so I'm confident that this is the issue.

@dgossow
Copy link
Author

dgossow commented Jan 17, 2013

👍

@dgossow
Copy link
Author

dgossow commented Jan 17, 2013

I can confirm that this doesn't happen any more on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants