Bug 207592

Summary: krunner crashes when KBookmarkManager encounters an error due to GUI code in threads
Product: [Plasma] krunner Reporter: George Kiagiadakis <mail>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description George Kiagiadakis 2009-09-16 16:25:00 UTC
Version:            (using KDE 4.3.1)
OS:                Linux
Installed from:    Debian testing/unstable Packages

Hi,
I had some trouble with my ~/.kde and KBookmarkManager could not read its bookmarks.xml file from~/.kde/share/apps/konqueror.

Apparently, KBookmarkManager shows a KMessageBox to inform the user when this happens, but krunner is running this code from a thread different than the main thread, which causes a crash.

The first backtrace I got was:
(I'm not pasting the other threads, they don't make much sense)

Thread 2 (Thread 0xa7dfdb90 (LWP 6221)):
[KCrash Handler]
#6  0xb6b0a046 in ?? () from /usr/lib/libQtDBus.so.4
#7  0xb6b0a9d8 in ?? () from /usr/lib/libQtDBus.so.4
#8  0xb69e9b33 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQtCore.so.4
#9  0xb69e9f60 in QMetaObject::activate(QObject*, QMetaObject const*, int, int, void**) () from /usr/lib/libQtCore.so.4
#10 0xb69e9feb in QObject::destroyed(QObject*) () from /usr/lib/libQtCore.so.4
#11 0xb69eadf9 in QObject::~QObject() () from /usr/lib/libQtCore.so.4
#12 0xb663be3d in KIO::Scheduler::~Scheduler() () from /usr/lib/libkio.so.5
#13 0xb663f131 in ?? () from /usr/lib/libkio.so.5
#14 0xb65748db in ?? () from /usr/lib/libkio.so.5
#15 0xb7ed1589 in exit () from /lib/i686/cmov/libc.so.6
#16 0xb6f1fdab in ?? () from /usr/lib/libQtGui.so.4
#17 0xb7a83e5a in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib/libkdeui.so.5
#18 0xb7a83e96 in ?? () from /usr/lib/libkdeui.so.5
#19 0xb778b2b6 in _XIOError () from /usr/X11R6/lib/libX11.so.6
#20 0xb7792f4f in _XReply () from /usr/X11R6/lib/libX11.so.6
#21 0xb7788361 in XTranslateCoordinates () from /usr/X11R6/lib/libX11.so.6
#22 0xb6f4d0c0 in QWidget::mapFromGlobal(QPoint const&) const () from /usr/lib/libQtGui.so.4
#23 0xb6f4d111 in QWidget::mapFromGlobal(QPoint const&) const () from /usr/lib/libQtGui.so.4
#24 0xb6f4d111 in QWidget::mapFromGlobal(QPoint const&) const () from /usr/lib/libQtGui.so.4
#25 0xb6f4d111 in QWidget::mapFromGlobal(QPoint const&) const () from /usr/lib/libQtGui.so.4
#26 0xb6f4d111 in QWidget::mapFromGlobal(QPoint const&) const () from /usr/lib/libQtGui.so.4
#27 0xb6ec3bb7 in QApplicationPrivate::dispatchEnterLeave(QWidget*, QWidget*) () from /usr/lib/libQtGui.so.4
#28 0xb6f20ca1 in QApplicationPrivate::enterModal_sys(QWidget*) () from /usr/lib/libQtGui.so.4
#29 0xb6ec2d4e in QApplicationPrivate::enterModal(QWidget*) () from /usr/lib/libQtGui.so.4
#30 0xb6f17d2d in QWidgetPrivate::show_helper() () from /usr/lib/libQtGui.so.4
#31 0xb6f1822b in QWidget::setVisible(bool) () from /usr/lib/libQtGui.so.4
#32 0xb73a201d in QDialog::setVisible(bool) () from /usr/lib/libQtGui.so.4
#33 0xb73a1136 in QDialog::exec() () from /usr/lib/libQtGui.so.4
#34 0xb7a0077c in KMessageBox::createKMessageBox(KDialog*, QIcon const&, QString const&, QStringList const&, QString const&, bool*, QFlags<KMessageBox::Option>, QString const&, QMessageBox::Icon) ()
   from /usr/lib/libkdeui.so.5
#35 0xb7a01a91 in KMessageBox::createKMessageBox(KDialog*, QMessageBox::Icon, QString const&, QStringList const&, QString const&, bool*, QFlags<KMessageBox::Option>, QString const&) ()
   from /usr/lib/libkdeui.so.5
#36 0xb7a02883 in KMessageBox::errorListWId(unsigned long, QString const&, QStringList const&, QString const&, QFlags<KMessageBox::Option>) () from /usr/lib/libkdeui.so.5
#37 0xb7a02aa1 in KMessageBox::error(QWidget*, QString const&, QString const&, QFlags<KMessageBox::Option>) () from /usr/lib/libkdeui.so.5
#38 0xb6678b63 in KBookmarkManager::saveAs(QString const&, bool) const () from /usr/lib/libkio.so.5
#39 0xb6678cef in KBookmarkManager::save(bool) const () from /usr/lib/libkio.so.5
#40 0xb6676b16 in KBookmarkManager::parse() const () from /usr/lib/libkio.so.5
#41 0xb6677271 in KBookmarkManager::internalDocument() const () from /usr/lib/libkio.so.5
#42 0xb66772cf in KBookmarkManager::root() const () from /usr/lib/libkio.so.5
#43 0xa9adebb0 in ?? () from /usr/lib/kde4/krunner_bookmarksrunner.so
#44 0xb7caf797 in Plasma::AbstractRunner::performMatch(Plasma::RunnerContext&) () from /usr/lib/libplasma.so.3
#45 0xb7d252cb in ?? () from /usr/lib/libplasma.so.3
#46 0xb55f24f4 in ?? () from /usr/lib/libthreadweaver.so.4
#47 0xb55f2871 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#48 0xb55f148a in ?? () from /usr/lib/libthreadweaver.so.4
#49 0xb55f1afb in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#50 0xb68e3582 in ?? () from /usr/lib/libQtCore.so.4
#51 0xb51434b5 in start_thread () from /lib/i686/cmov/libpthread.so.0
#52 0xb7f82a5e in clone () from /lib/i686/cmov/libc.so.6

Fortunately some global KIO destructor crashed as well there, which allowed me to have this backtrace from drkonqi. Because this backtrace doesn't have enough debug symbols, I tried to reproduce again and I got this from gdb directly:

Thread 3 (Thread 0xa85feb90 (LWP 8177)):
#0  0xb80d9424 in __kernel_vsyscall ()  
#1  0xb7fe7467 in poll () from /lib/i686/cmov/libc.so.6
---Type <return> to continue, or q <return> to quit--- 
#2  0xb520fc8b in g_poll () from /usr/lib/libglib-2.0.so.0
#3  0xb52028e5 in ?? () from /usr/lib/libglib-2.0.so.0    
#4  0xb5202b98 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#5  0xb6a6e858 in QEventDispatcherGlib::processEvents (this=0x92e2020, flags=...) at kernel/qeventdispatcher_glib.cpp:327
#6  0xb6a4201a in QEventLoop::processEvents (this=0xa85fdb3c, flags=...) at kernel/qeventloop.cpp:149                    
#7  0xb6a42462 in QEventLoop::exec (this=0xa85fdb3c, flags=...) at kernel/qeventloop.cpp:201                             
#8  0xb7410193 in QDialog::exec (this=0xa7200738) at dialogs/qdialog.cpp:498                                             
#9  0xb7a6f77c in KMessageBox::createKMessageBox (dialog=0xa7200738, icon=..., text=..., strlist=..., ask=..., checkboxReturn=0x0, options=..., 
    details=..., notifyType=QMessageBox::Critical) at ../../kdeui/dialogs/kmessagebox.cpp:331                                                   
#10 0xb7a70a91 in KMessageBox::createKMessageBox (dialog=0xa7200738, icon=QMessageBox::Critical, text=..., strlist=..., ask=..., checkboxReturn=0x0, 
    options=..., details=...) at ../../kdeui/dialogs/kmessagebox.cpp:151                                                                             
#11 0xb7a71883 in KMessageBox::errorListWId (parent_id=33554473, text=..., strlist=..., caption=..., options=...)                                    
    at ../../kdeui/dialogs/kmessagebox.cpp:849                                                                                                       
#12 0xb7a71aa1 in KMessageBox::error (parent=0x9143d08, text=..., caption=..., options=...) at ../../kdeui/dialogs/kmessagebox.cpp:813               

#13 0xb66e7b63 in KBookmarkManager::saveAs (this=0x929c8f8, filename=..., toolbarCache=true) at ../../kio/bookmarks/kbookmarkmanager.cc:419
#14 0xb66e7cef in KBookmarkManager::save (this=0x929c8f8, toolbarCache=<value optimized out>) at ../../kio/bookmarks/kbookmarkmanager.cc:368
#15 0xb66e5b16 in KBookmarkManager::parse (this=0x929c8f8) at ../../kio/bookmarks/kbookmarkmanager.cc:346                                   
#16 0xb66e6271 in KBookmarkManager::internalDocument (this=0x929c8f8) at ../../kio/bookmarks/kbookmarkmanager.cc:306                        
#17 0xb66e62cf in KBookmarkManager::root (this=0x929c8f8) at ../../kio/bookmarks/kbookmarkmanager.cc:434                                    
#18 0xa9b4dbb0 in BookmarksRunner::match (this=0x929b540, context=...) at ../../../../plasma/runners/bookmarks/bookmarksrunner.cpp:57       
#19 0xb7d1e797 in Plasma::AbstractRunner::performMatch (this=0x929b540, localContext=...) at ../../plasma/abstractrunner.cpp:160            
#20 0xb7d942cb in Plasma::FindMatchesJob::run (this=0x9303698) at ../../plasma/private/runnerjobs.cpp:158                                   
---Type <return> to continue, or q <return> to quit---                                                                                      
#21 0xb56614f4 in ThreadWeaver::JobRunHelper::runTheJob (this=0xa85fe2c8, th=0x9341578, job=0x9303698) at ../../../threadweaver/Weaver/Job.cpp:106
#22 0xb5661871 in ThreadWeaver::Job::execute (this=0x9303698, th=0x9341578) at ../../../threadweaver/Weaver/Job.cpp:135                           
#23 0xb566048a in ThreadWeaver::ThreadRunHelper::run (this=0xa85fe330, parent=0x91439e0, th=0x9341578) at ../../../threadweaver/Weaver/Thread.cpp:95
#24 0xb5660afb in ThreadWeaver::Thread::run (this=0x9341578) at ../../../threadweaver/Weaver/Thread.cpp:142                                         
#25 0xb6952582 in QThreadPrivate::start (arg=0x9341578) at thread/qthread_unix.cpp:188                                                              
#26 0xb51b24b5 in start_thread () from /lib/i686/cmov/libpthread.so.0                                                                               
#27 0xb7ff1a5e in clone () from /lib/i686/cmov/libc.so.6  

(In this backtrace it has succeeded in showing the messagebox from thread 3 and it is in a deadlocked state.)
Comment 1 Matthias Fuchs 2010-12-07 12:27:10 UTC
SVN commit 1204453 by mfuchs:

Adds method to KBookmarkManager disable showing dialogs on errors.
An "error" signal is emitted in any case.
BUG:207592
CCMAIL:dfaure@kde.org

 M  +22 -5     kbookmarkmanager.cc  
 M  +32 -0     kbookmarkmanager.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1204453