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

Simple GUIPlugin causes Segfault when closing gzclient #2301

Open
osrf-migration opened this issue Jun 15, 2017 · 6 comments
Open

Simple GUIPlugin causes Segfault when closing gzclient #2301

osrf-migration opened this issue Jun 15, 2017 · 6 comments
Labels
7 Gazebo 7 bug Something isn't working gui major

Comments

@osrf-migration
Copy link

Original report (archived issue) by MarcZofka (Bitbucket: GzMRZ).


Dear colleagues,

i have noticed a strange bug in a GUIPlugin, i have implemented. When starting gzserver and gzclient separately, the plugin causes a segfault in the gzserver process during closing the client:

#!c++


Thread 1 "gzclient" received signal SIGSEGV, Segmentation fault.
0x0000000000ba70c0 in ?? ()
(gdb) 
(gdb) bt
#0  0x0000000000ba70c0 in ?? ()
#1  0x00007ffff77411c0 in gazebo::gui::RenderWidget::~RenderWidget() () from /usr/lib/x86_64-linux-gnu/libgazebo_gui.so.7
#2  0x00007ffff77412f9 in gazebo::gui::RenderWidget::~RenderWidget() () from /usr/lib/x86_64-linux-gnu/libgazebo_gui.so.7
#3  0x00007ffff76dadd1 in gazebo::gui::MainWindow::closeEvent(QCloseEvent*) () from /usr/lib/x86_64-linux-gnu/libgazebo_gui.so.7
#4  0x00007ffff53ab8d0 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#5  0x00007ffff578f9b3 in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#6  0x00007ffff5354fdc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#7  0x00007ffff535bf16 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#8  0x00007ffff720590d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007ffff53a8131 in QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007ffff53c7c56 in QApplication::x11ClientMessage(QWidget*, _XEvent*, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007ffff53d7e32 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007ffff5402542 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff1f10197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff1f103f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff1f1049c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff72362ae in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#17 0x00007ffff5402616 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007ffff720418f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007ffff72044f5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#20 0x00007ffff720a4b9 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007ffff76b7873 in gazebo::gui::run(int, char**) () from /usr/lib/x86_64-linux-gnu/libgazebo_gui.so.7
#22 0x00000000004013aa in ?? ()
#23 0x00007ffff6536830 in __libc_start_main (main=0x401390, argc=2, argv=0x7fffffffd2a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd298) at ../csu/libc-start.c:291
#24 0x0000000000401459 in _start ()
(gdb) 

I have trimmed my plugin down to a very minimalistic version, but the segfault still appears in some cases (about 50%):

#!c++

#ifndef GAZEBO_GUI_SCENE_GRAPH_PLUGIN_H_INCLUDED
#define GAZEBO_GUI_SCENE_GRAPH_PLUGIN_H_INCLUDED

// System Includes
#include <memory>

// Gazebo Includes
#include <gazebo/gui/GuiPlugin.hh>

// See: https://bugreports.qt-project.org/browse/QTBUG-22829
#ifndef Q_MOC_RUN
# include <gazebo/transport/transport.hh>
# include <gazebo/gui/gui.hh>
#endif

namespace gazebo
{

class GAZEBO_VISIBLE GUISceneGraphPlugin : public GUIPlugin
{
  Q_OBJECT

public:
  //! Constructor.
  GUISceneGraphPlugin();
  //! Destructor.
  virtual ~GUISceneGraphPlugin();

  //! This function is only called when a GUI plugin is loaded from an SDF file. This function is
  //! not called when a GUI plugin is loaded via a gui.ini file.
  //! \param[in] _sdf Pointer the the SDF element of the plugin. This is the plugin SDF,
  //! <plugin ...>, and its children.
  void Load(sdf::ElementPtr sdf);

private:

  float m_clipping_min;
  float m_clipping_max;

};

} // end of ns gazebo
#endif // GAZEBO_GUI_SCENE_GRAPH_PLUGIN_H_INCLUDED

and the definition in:

#!c++

// Gazebo Includes
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <gazebo/msgs/vector3d.pb.h>

// Ignition Includes
#include <ignition/math/Vector3.hh>

// Ogre Includes
#include <OGRE/OgreManualObject.h>
#include <OGRE/OgreException.h>

// Std Includes
#include <list>

#include "GUISceneGraphPlugin.hh"

namespace gazebo {

// Register this plugin with the simulator
GZ_REGISTER_GUI_PLUGIN(GUISceneGraphPlugin)

/////////////////////////////////////////////////
GUISceneGraphPlugin::GUISceneGraphPlugin()
  : GUIPlugin()
  , m_clipping_min(5)
  , m_clipping_max(1000)
{
}

/////////////////////////////////////////////////
GUISceneGraphPlugin::~GUISceneGraphPlugin()
{}

/////////////////////////////////////////////////
void GUISceneGraphPlugin::Load(sdf::ElementPtr sdf)
{
  gzmsg << "(GUISceneGraphPlugin) Load() called." << std::endl;
}

} // end of ns gazebo

My exemplary world file is as follows:

#!c++

?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">
    <gui>
        <plugin name="sampleplugin" filename="libGUISceneGraphPlugin.so"/>
    </gui>

    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>
    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>
  </world>
</sdf>

I tried to find some evidences on google, but i merely found an entry on the gazebo answers list, where somebody seems to have the same problem: Gazebo Anwers

It seems to be a problem with GUI plugins in general, so I would be happy if anybody has an idea, why this strange segfault appears.

Best regards!

@osrf-migration
Copy link
Author

Original comment by MarcZofka (Bitbucket: GzMRZ).


  • Edited issue description

1 similar comment
@osrf-migration
Copy link
Author

Original comment by MarcZofka (Bitbucket: GzMRZ).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).


could it be related to issue #2133? Can you verify if the problem is also present in gazebo8? Please note that there is a new parameter called --gui-client-plugin to load the GUI plugins.

@osrf-migration
Copy link
Author

Original comment by MarcZofka (Bitbucket: GzMRZ).


Hi,

your assumption seems possible: In the minimalistic version (see above) of my gui plugin i had several gzclient runs, where i have not seen the black widget, which typically should appear when no exact size of the widget is defined in the plugin. In the full version of my plugin, where i have a complex layout with text fields, checkboxes and so on i cannot confirm the behavior.

Unfortunately i have no possibility to validate the repeatability of this bug in gz8. Is the parameter, mentioned before, also necessary in gz7?

Best regards!

@osrf-migration
Copy link
Author

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


You state that the plugin causes a seg-fault in gzserver, but the backtrace says gzclient.

I'll see if I can find time to try to reproduce this.

@osrf-migration
Copy link
Author

Original comment by MarcZofka (Bitbucket: GzMRZ).


Hi,

yeah you are right: the segfault appears in the gzclient. Could anyone reproduce the error?

best regards!

@osrf-migration osrf-migration added major gui bug Something isn't working 7 Gazebo 7 labels Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7 Gazebo 7 bug Something isn't working gui major
Projects
None yet
Development

No branches or pull requests

1 participant