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 on external plugin loading #25

Closed
osrf-migration opened this issue Jan 24, 2018 · 4 comments
Closed

Segfault on external plugin loading #25

osrf-migration opened this issue Jan 24, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@osrf-migration
Copy link

Original report (archived issue) by Andrés Fortier (Bitbucket: andres_fortier).


Disclaimer: I know this is a weird issue and may be difficult to debug, esp. as I am the only one on a group of 4 devs seeing it. However I'm running out of ideas on what this may be, hence I created the issue. Any help will be much appreciated.

We have an application that defines a set of custom plugins. After updating ign_gui (and other dependencies) the plugin load procedure started to segfault. The details:

Plugin::Plugin() : dataPtr(new PluginPrivate)
{
  std::cout << "!!! INIT !!! " << std::endl;
}

and tested with different plugins. The result is that all the plugins shipped with ign_gui call the constructor, but those defined outside (i.e. in an app that use ign_gui as a library) don't call it.

  • Same as above happens for the destructors. When a ing_gui plugin is removed from the UI by hitting the X button the destructor is called. However, for "outside" plugins the destructor is not called.
  • The constructor not being called would explain dataPtr having garbage, as it is the only place where it is initialized.
  • Given that dataPtr is private I can't think on a workaround on our side to fix it.
  • Below is the gdb output as stacktrace:
$ gdb visualizer 
[...]
Reading symbols from visualizer...done.
(gdb) r
Starting program: /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/install/bin/visualizer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Msg] Visualizer 0.1.0
[New Thread 0x7fffde049700 (LWP 24813)]
[New Thread 0x7fffd408d700 (LWP 24814)]
[New Thread 0x7fffd3875700 (LWP 24815)]
[New Thread 0x7fffd3074700 (LWP 24816)]
[GUI] [Msg] Applying stylesheet [:/style.qss]
[GUI] [Msg] Loading plugin [libRenderWidget.so]
[New Thread 0x7fffc23b6700 (LWP 24818)]
[New Thread 0x7fffc1bb5700 (LWP 24819)]
[New Thread 0x7fffc13b4700 (LWP 24820)]
[New Thread 0x7fffc0bb3700 (LWP 24821)]
[New Thread 0x7fffbbfff700 (LWP 24822)]
Thread 1 "visualizer" received signal SIGSEGV, Segmentation fault.
ignition::gui::Plugin::DeleteLaterRequested (this=0x7250b0) at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/ign_gui/src/Plugin.cc:150
150       return this->dataPtr->deleteLaterRequested;
(gdb) bt
#0  ignition::gui::Plugin::DeleteLaterRequested (this=0x7250b0) at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/ign_gui/src/Plugin.cc:161
#1  0x00007ffff7b884e6 in ignition::gui::addPluginsToWindow () at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/ign_gui/src/Iface.cc:589
#2  0x00007ffff7b8e35b in ignition::gui::MainWindow::OnAddPlugin (this=<optimized out>, _plugin=...) at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/ign_gui/src/MainWindow.cc:269
#3  0x00007ffff7bba5a4 in ignition::gui::MainWindow::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/build/ign_gui/include/ignition/gui/moc_MainWindow.cpp:88
#4  0x00007ffff6fc7d2a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6fd21a5 in QSignalMapper::mapped(QString const&) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff6fd36f2 in QSignalMapper::map(QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff6fc7d2a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff760b412 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff760d898 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff778fe52 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff77960ec in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff779a060 in QMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff7657fc8 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff779aab3 in QMenu::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff761505c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff761ac19 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff6f9938b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff7619b32 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff767291d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007ffff7674b7b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff761505c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff761a516 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff6f9938b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007ffff53ad4e1 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007ffff53af1a5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007ffff5392f08 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#27 0x00007ffff7ead200 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#28 0x00007ffff4a98197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff4a983f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007ffff4a9849c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007ffff6fef7cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007ffff6f96b4a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007ffff6f9ebec in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#34 0x00007ffff7b86790 in ignition::gui::runMainWindow () at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/ign_gui/src/Iface.cc:659
#35 0x000000000040163e in main (argc=<optimized out>, argv=<optimized out>) at /home/andres/OSRF/DrakeFrontEnd/delphyne_ws/src/delphyne_gui/visualizer/visualizer.cc:102
  • Our class is defined as:
class RenderWidget : public ignition::gui::Plugin {
  Q_OBJECT

 public:
  /// \brief Default constructor.
  explicit RenderWidget(QWidget* parent = 0);
[...]
}

and

RenderWidget::RenderWidget(QWidget* parent)
    : Plugin(), initializedScene(false), engine(nullptr) {
[...]
}

And of course, let me know if you need more info. Any pointers / hints will be greatly appreciated.

@osrf-migration
Copy link
Author

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Interesting problem, some ideas:

The result is that all the plugins shipped with ign_gui call the constructor, but those defined outside (i.e. in an app that use ign_gui as a library) don't call it.

Have you tried the example plugins? They are essentially "external plugins".

While this->dataPtr is not a nullptr, it seems to have garbage

Yeah I suppose that would happen if the constructor is not called

explicit RenderWidget(QWidget* parent = 0);

Can't imagine how that could change anything, but have you tried removing the explicit?

@osrf-migration
Copy link
Author

Original comment by Andrés Fortier (Bitbucket: andres_fortier).


Thanks for the quick reply @chapulina ! After nuking my entire workspace things started to work again (I've tried already nuking the build dir with no luck). I really have no idea what is/was going on, but it seems to be fixed for now. Thanks again and sorry for stealing time from you.

@osrf-migration
Copy link
Author

Original comment by Andrés Fortier (Bitbucket: andres_fortier).


  • changed state from "new" to "invalid"

The issue didn't have to do with ign_gui.

@osrf-migration
Copy link
Author

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Glad to hear you figured it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant