GNS3 / gns3-gui

GNS3 Graphical Network Simulator
http://www.gns3.com
GNU General Public License v3.0
2.17k stars 436 forks source link

Sometimes the GUI segfault when we delete nodes #1654

Closed julien-duponchelle closed 8 years ago

julien-duponchelle commented 8 years ago

I open the issue for trying to track down the issue.

julien-duponchelle commented 8 years ago

I suspect this arrive when you delete a lot of nodes heavy linked together. But I don't easily reproduce.

julien-duponchelle commented 8 years ago

I suggest that we wrote a script using the GNS3 api adding and removing nodes randomly.

julien-duponchelle commented 8 years ago

I think I start to better isolate the issue.

The best scenario for reproducing the issue:

But not warranty

I finally got a GDB stack trace:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x0000000104e3069e in QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem*, QPainter*, QTransform const*, QRegion*, QWidget*, double, QTransform const*) () from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets

(gdb) where
#0  0x0000000104e3069e in QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem*, QPainter*, QTransform const*, QRegion*, QWidget*, double, QTransform const*) () from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#1  0x0000000104e30472 in QGraphicsScenePrivate::drawItems(QPainter*, QTransform const*, QRegion*, QWidget*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#2  0x0000000104e518af in QGraphicsView::paintEvent(QPaintEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#3  0x00000001045c4122 in sipQGraphicsView::paintEvent(QPaintEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#4  0x0000000104b38291 in QWidget::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#5  0x0000000104c29ffd in QFrame::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#6  0x0000000104cb58f3 in QAbstractScrollArea::viewportEvent(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#7  0x0000000104e4f419 in QGraphicsView::viewportEvent(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#8  0x00000001045c4af8 in sipQGraphicsView::viewportEvent(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#9  0x0000000104cb64a5 in QAbstractScrollAreaFilter::eventFilter(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#10 0x00000001034c068a in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#11 0x0000000104af8b61 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#12 0x0000000104afb4c0 in QApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#13 0x000000010463b653 in sipQApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#14 0x00000001034c03f4 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#15 0x0000000104b31d84 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#16 0x0000000104b32558 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#17 0x0000000104b32023 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#18 0x0000000104b32558 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#19 0x0000000104b32023 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#20 0x0000000104b32558 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#21 0x0000000104b32023 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#22 0x0000000104b06511 in QWidgetBackingStore::doSync() ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#23 0x0000000104b384bd in QWidget::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#24 0x0000000104c4107f in QMainWindow::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#25 0x000000010459f428 in sipQMainWindow::event(QEvent*) () from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#26 0x0000000104af8b76 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#27 0x0000000104afb4c0 in QApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#28 0x000000010463b653 in sipQApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#29 0x00000001034c03f4 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#30 0x00000001034c1014 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#31 0x0000000104e1c652 in QGraphicsScenePrivate::_q_processDirtyItems() ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#32 0x00000001034ec6dc in QObject::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#33 0x0000000104e283e3 in QGraphicsScene::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#34 0x00000001045c87b8 in sipQGraphicsScene::event(QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#35 0x0000000104af8b76 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#36 0x0000000104afb4c0 in QApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtWidgets.framework/Versions/5/QtWidgets
#37 0x000000010463b653 in sipQApplication::notify(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/QtWidgets.so
#38 0x00000001034c03f4 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#39 0x00000001034c1014 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
#40 0x0000000112335bae in QCocoaEventDispatcherPrivate::processPostedEvents() ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib
#41 0x0000000112336481 in QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) ()
   from /Users/noplay/.virtualenvs/gns3-gui/lib/python3.5/site-packages/PyQt5/Qt/plugins/platforms/libqcocoa.dylib
#42 0x00007fff8ff08881 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
   from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#43 0x00007fff8fee7fbc in __CFRunLoopDoSources0 () from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#44 0x00007fff8fee74df in __CFRunLoopRun () from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#45 0x00007fff8fee6ed8 in CFRunLoopRunSpecific () from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#46 0x00007fff8d2e8935 in RunCurrentEventLoopInMode ()
   from /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
#47 0x00007fff8d2e876f in ReceiveNextEventCommon ()
   from /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
#48 0x00007fff8d2e85af in _BlockUntilNextEventMatchingListInModeWithFilter ()
   from /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
#49 0x00007fff93522df6 in ?? () from /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
#50 0x00007fff5fbfe56c in ?? ()
#51 0x000000010f269110 in ?? ()
julien-duponchelle commented 8 years ago

The segfault is fixed

Instead of: https://github.com/GNS3/gns3-gui/commit/cf63b49b82c215dc60ee947bc2d3468a4e56db90#diff-e09b6c9303969eb087cd84e64f0a3822L120

We use a signal