Crash during project pruning

Maciej Cencora m.cencora at gmail.com
Fri Apr 8 16:05:29 UTC 2016


Short description: ProjectFolderItems are deleted by IProject::reloadModel
while FileManagerListJob is processing them.

Long description:
 - Project -> Open Configuration
 - CMake -> remove build dir
 - CMake -> add build dir
 - apply -> triggers CMakePreferences::configure()
 - while the configure job is running the file watches detect changes in
build dir
 - the changed directory (e.g. build/CMakeTmp) is enqueued for processing
in FileManagerListJob::addSubDir
 - configure job finishes -> IProject::reloadModel is triggered -> all
ProjectFolderItems are removed
 - FileManagerListJob tries to process next element
FileManagerListJob::startNextJob() ... m_item = m_listQueue.dequeue();
 - m_item is a pointer to deleted object (destroyed by
IProjectModel::reloadModel)

I see two solutions (and I think I'd rather go with second one):
 - remove any use of reloadModal and function alltogether
 - convert FileManagerListJob to take Path/IndexedString by value instead
of ProjectFolderItem*

Any suggestions?

Regards,
Maciej



2016-04-08 15:06 GMT+02:00 Kevin Funk <kfunk at kde.org>:

> On Friday, April 8, 2016 2:48:49 PM CEST Maciej Cencora wrote:
> > In the mean time, here is another crash related to cmake configuration:
> >
> > #0  KDevelop::Path::Path (this=0x7fffffffb350, other=..., child=...) at
> > ../util/path.cpp:130
> > #1  0x00007ffff2280cc3 in KDevelop::ProjectBaseItem::path
> > (this=this at entry=0x17ccaa0)
> > at ../project/projectmodel.cpp:451
> > #2  0x00007ffff22a1ab0 in KDevelop::FileManagerListJob::startNextJob
> > (this=0x263add0) at ../project/filemanagerlistjob.cpp:87
> > #3  0x00007ffff5861e81 in QObject::event(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #4  0x00007ffff612505c in QApplicationPrivate::notify_helper(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #5  0x00007ffff612a516 in QApplication::notify(QObject*, QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #6  0x00007ffff58325cb in QCoreApplication::notifyInternal(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #7  0x00007ffff58349c6 in
> > QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
> > from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #8  0x00007ffff5888653 in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #9  0x00007fffeda85137 in g_main_context_dispatch () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #10 0x00007fffeda85390 in ?? () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #11 0x00007fffeda8543c in g_main_context_iteration () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #12 0x00007ffff5888a5f in
> >
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #13 0x00007ffff582fd8a in
> > QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #14 0x00007ffff631fc4d in QDialog::exec() () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #15 0x00007ffff7ad8104 in
> KDevelop::ProjectControllerPrivate::projectConfig
> > (this=<optimized out>, obj=<optimized out>) at
> > ../shell/projectcontroller.cpp:157
> > #16 0x00007ffff5860e2f in QMetaObject::activate(QObject*, int, int,
> void**)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #17 0x00007ffff611b412 in QAction::triggered(bool) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #18 0x00007ffff611d898 in QAction::activate(QAction::ActionEvent) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #19 0x00007ffff629fdf2 in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #20 0x00007ffff62a608c in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #21 0x00007ffff62aa000 in QMenu::mouseReleaseEvent(QMouseEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #22 0x00007ffff6167f88 in QWidget::event(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #23 0x00007ffff62aaa53 in QMenu::event(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #24 0x00007ffff612505c in QApplicationPrivate::notify_helper(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #25 0x00007ffff612ac19 in QApplication::notify(QObject*, QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #26 0x00007ffff58325cb in QCoreApplication::notifyInternal(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #27 0x00007ffff6129b32 in QApplicationPrivate::sendMouseEvent(QWidget*,
> > QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
> > from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #28 0x00007ffff61828dd in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #29 0x00007ffff6184b3b in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #30 0x00007ffff612505c in QApplicationPrivate::notify_helper(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #31 0x00007ffff612a516 in QApplication::notify(QObject*, QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #32 0x00007ffff58325cb in QCoreApplication::notifyInternal(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #33 0x00007ffff5b74521 in
> >
> QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mou
> > seEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #34 0x00007ffff5b761e5 in
> >
> QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriva
> > te::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #35 0x00007ffff5b59f38 in
> >
> QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEve
> > ntsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #36 0x00007fffdd1c1d90 in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
> > #37 0x00007fffeda85137 in g_main_context_dispatch () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #38 0x00007fffeda85390 in ?? () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #39 0x00007fffeda8543c in g_main_context_iteration () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #40 0x00007ffff5888a5f in
> >
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #41 0x00007ffff582fd8a in
> > QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #42 0x00007ffff62a4de0 in QMenu::exec(QPoint const&, QAction*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #43 0x00007fffb14760c1 in ProjectTreeView::popupContextMenu
> > (this=<optimized out>, pos=...) at
> > ../plugins/projectmanagerview/projecttreeview.cpp:359
> > #44 0x00007ffff5860e2f in QMetaObject::activate(QObject*, int, int,
> void**)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #45 0x00007ffff614ebe5 in QWidget::customContextMenuRequested(QPoint
> > const&) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #46 0x00007ffff616897e in QWidget::event(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #47 0x00007ffff6266b2e in QFrame::event(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #48 0x00007ffff638c5ab in QAbstractItemView::viewportEvent(QEvent*) ()
> from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #49 0x00007ffff63cb0cc in QTreeView::viewportEvent(QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #50 0x00007ffff58323b2 in
> > QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #51 0x00007ffff612503c in QApplicationPrivate::notify_helper(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #52 0x00007ffff612bea1 in QApplication::notify(QObject*, QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #53 0x00007ffff58325cb in QCoreApplication::notifyInternal(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #54 0x00007ffff61826b2 in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #55 0x00007ffff6184b3b in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #56 0x00007ffff612505c in QApplicationPrivate::notify_helper(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #57 0x00007ffff612a516 in QApplication::notify(QObject*, QEvent*) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
> > #58 0x00007ffff58325cb in QCoreApplication::notifyInternal(QObject*,
> > QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #59 0x00007ffff5b74521 in
> >
> QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mou
> > seEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #60 0x00007ffff5b761e5 in
> >
> QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriva
> > te::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #61 0x00007ffff5b59f38 in
> >
> QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEve
> > ntsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
> > #62 0x00007fffdd1c1d90 in ?? () from
> > /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
> > #63 0x00007fffeda85137 in g_main_context_dispatch () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #64 0x00007fffeda85390 in ?? () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #65 0x00007fffeda8543c in g_main_context_iteration () from
> > /lib/x86_64-linux-gnu/libglib-2.0.so.0
> > #66 0x00007ffff5888a5f in
> >
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> > () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #67 0x00007ffff582fd8a in
> > QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #68 0x00007ffff5837e2c in QCoreApplication::exec() () from
> > /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> > #69 0x000000000040c837 in main (argc=<optimized out>, argv=<optimized
> out>)
> > at ../app/main.cpp:680
> >
> > (gdb) print other
> > $2 = (const KDevelop::Path &) @0x38: <error reading variable>
>
> Known crash (same backtrace, different trigger, though):
>   https://bugs.kde.org/show_bug.cgi?id=355241
>
> Patches *very* welcome!
>
> Could you have a look?
>
> > This one is almost 100% reproducible.
> > Open project settings -> cmake -> remove the only build dir -> add new
> > build dir with same path as previous -> "Apply" -> cmake configuration is
> > started and while it is still running, the crash occurs.
> > For this one I haven't found the culprit yet.
> >
> > Regards,
> > Maciej
> >
> > 2016-04-08 14:22 GMT+02:00 Maciej Cencora <m.cencora at gmail.com>:
> > > @Kevin:
> > > I've send you a wrong backtrace privately.
> > >
> > > It seems I don't have the original backtrace anymore. Will try to get
> it,
> > > but most of the time it does not crash so it may take some time.
> > >
> > > Regards,
> > > Maciej
> > >
> > > 2016-04-08 12:52 GMT+02:00 Kevin Funk <kfunk at kde.org>:
> > >> On Friday, April 8, 2016 12:44:04 PM CEST Maciej Cencora wrote:
> > >> > Hi,
> > >> >
> > >> > I need directions on fixing a crash.
> > >> > Project->Prune Selection action triggers removal of a whole build
> > >>
> > >> directory.
> > >>
> > >> > File notifier catches deletion of commands file and triggers
> > >> > CMakeManager::dirtyFile -> reload -> createImportJob ->
> > >>
> > >> IProject::configure.
> > >>
> > >> > In the end cmake configure stage gets triggered while its build dir
> is
> > >> > being removed. Depending on timing it may or may not trigger a
> crash.
> > >>
> > >> ... and the backtrace is? :)
> > >>
> > >> > Any ideas what would be the best way to fix this?
> > >> >
> > >> > Regards,
> > >> > Maciej
> > >>
> > >> --
> > >> Kevin Funk | kfunk at kde.org | http://kfunk.org
>
>
> --
> Kevin Funk | kfunk at kde.org | http://kfunk.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160408/fc1f7e8c/attachment-0001.html>


More information about the KDevelop-devel mailing list