Bug 310703

Summary: assert() triggered during session startup
Product: [Applications] kdevelop Reporter: Andreas Pakulat <apaku>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 4.4.60   
Target Milestone: 4.3.0   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andreas Pakulat 2012-11-26 11:03:16 UTC
Application: kdevelop (4.4.60)
KDE Platform Version: 4.8.4 (4.8.4)
Qt Version: 4.8.2
Operating System: Linux 3.2.0-4-686-pae i686
Distribution: Debian GNU/Linux unstable (sid)

-- Information about the crash:
- What I was doing when the application crashed:
I logged into my KDE session and that automatically started KDevelop. As can be seen in the backtrace the assert in qtDocsLocation function triggered. I suppose the qmake execution was taking more than 5 seconds since there were loads of other things going on during the session startup.

I think the assert is totally wrong in this place, the author of the code cannot assume that running qmake takes only five seconds, it could be delayed for any reason. IMO the code needs to be refactored so it starts qmake and once that one has provided the result is the UI updated instead of doing the initialization synchronously like it is right now.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Aborted
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
[Current thread is 1 (Thread 0xb1ca5710 (LWP 26958))]

Thread 5 (Thread 0xadcc5b70 (LWP 27341)):
#0  0xb770b424 in __kernel_vsyscall ()
#1  0xb50aa703 in pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_timedwait.S:236
#2  0xb51ed904 in __pthread_cond_timedwait (cond=0x90461c8, mutex=0x90461b0, abstime=0xadcc52c8) at forward.c:152
#3  0xb5f8a3ed in wait (time=1000, this=0x90461b0) at thread/qwaitcondition_unix.cpp:84
#4  QWaitCondition::wait (this=0x90478ac, mutex=0x90478b0, time=1000) at thread/qwaitcondition_unix.cpp:158
#5  0xb4a65b55 in KDevelop::DUChainPrivate::CleanupThread::run (this=0x90478a0) at /home/andreas/src/kdevplatform/language/duchain/duchain.cpp:282
#6  0xb5f89f00 in QThreadPrivate::start (arg=0x90478a0) at thread/qthread_unix.cpp:307
#7  0xb50a5c39 in start_thread (arg=0xadcc5b70) at pthread_create.c:304
#8  0xb51e07be in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 4 (Thread 0xab193b70 (LWP 27437)):
#0  0xb770b424 in __kernel_vsyscall ()
#1  0xb50aa20a in __pthread_cond_wait (cond=0xb5069650, mutex=0xb5069638) at pthread_cond_wait.c:153
#2  0xb51ed8ad in __pthread_cond_wait (cond=0xb5069650, mutex=0xb5069638) at forward.c:139
#3  0xb4f5619d in ?? () from /usr/lib/i386-linux-gnu/libQtScript.so.4
#4  0xb4f561cf in ?? () from /usr/lib/i386-linux-gnu/libQtScript.so.4
#5  0xb50a5c39 in start_thread (arg=0xab193b70) at pthread_create.c:304
#6  0xb51e07be in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xaa134b70 (LWP 27493)):
#0  0xb506ee11 in *__GI_clock_gettime (clock_id=1, tp=0xaa134018) at ../sysdeps/unix/clock_gettime.c:116
#1  0xb5fe8a35 in do_gettime (frac=0xaa134010, sec=0xaa134008) at tools/qelapsedtimer_unix.cpp:123
#2  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3  0xb60ce22e in QTimerInfoList::updateCurrentTime (this=0x9abd86c) at kernel/qeventdispatcher_unix.cpp:343
#4  0x09abcf70 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xa9933b70 (LWP 27494)):
#0  0xb506ee11 in *__GI_clock_gettime (clock_id=1, tp=0xa9933018) at ../sysdeps/unix/clock_gettime.c:116
#1  0xb5fe8a35 in do_gettime (frac=0xa9933010, sec=0xa9933008) at tools/qelapsedtimer_unix.cpp:123
#2  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3  0xb60ce22e in QTimerInfoList::updateCurrentTime (this=0xad301dbc) at kernel/qeventdispatcher_unix.cpp:343
#4  0x09b361d8 in ?? ()
#5  0x00000000 in ?? ()

Thread 1 (Thread 0xb1ca5710 (LWP 26958)):
[KCrash Handler]
#7  0xb770b424 in __kernel_vsyscall ()
#8  0xb5135941 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#9  0xb5138d72 in *__GI_abort () at abort.c:92
#10 0xb5f7ebfc in qt_message_output (msgType=QtFatalMsg, buf=0xad304940 "ASSERT: \"qmake.isEmpty() || !ret.isEmpty()\" in file /home/andreas/src/kdevelop/documentation/qthelp/qthelpqtdoc.cpp, line 50") at global/qglobal.cpp:2284
#11 0xb5f7f009 in qt_message (msgType=QtFatalMsg, msg=0xb61076d8 "ASSERT: \"%s\" in file %s, line %d", ap=0xbf83ee94 "\274\024\361\253H\024\361\253\062") at global/qglobal.cpp:2330
#12 0xb5f7f128 in qFatal (msg=msg@entry=0xb61076d8 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2513
#13 0xb5f7f1b5 in qt_assert (assertion=0xabf114bc "qmake.isEmpty() || !ret.isEmpty()", file=0xabf11448 "/home/andreas/src/kdevelop/documentation/qthelp/qthelpqtdoc.cpp", line=50) at global/qglobal.cpp:2010
#14 0xabf0ddbb in qtDocsLocation (qmake=...) at /home/andreas/src/kdevelop/documentation/qthelp/qthelpqtdoc.cpp:50
#15 0xabf0e037 in QtHelpQtDoc::registerDocumentations (this=0x908a298) at /home/andreas/src/kdevelop/documentation/qthelp/qthelpqtdoc.cpp:74
#16 0xabf0de72 in QtHelpQtDoc::QtHelpQtDoc (this=0x908a298, parent=0x92271e8, args=...) at /home/andreas/src/kdevelop/documentation/qthelp/qthelpqtdoc.cpp:60
#17 0xabf071de in QtHelpPlugin::loadQtDocumentation (this=0x92271e8, loadQtDoc=true) at /home/andreas/src/kdevelop/documentation/qthelp/qthelpplugin.cpp:76
#18 0xabf070fe in QtHelpPlugin::readConfig (this=0x92271e8) at /home/andreas/src/kdevelop/documentation/qthelp/qthelpplugin.cpp:65
#19 0xabf059fd in QtHelpPlugin::qt_static_metacall (_o=0x92271e8, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x914d9c0) at /home/andreas/src/build/kdevelop/documentation/qthelp/moc_qthelpplugin.cpp:54
#20 0xb60ad78a in QMetaCallEvent::placeMetaCall (this=0x924ecc0, object=0x92271e8) at kernel/qobject.cpp:525
#21 0xb60b1ccb in QObject::event (this=0x92271e8, e=0x924ecc0) at kernel/qobject.cpp:1195
#22 0xb558447c in QApplicationPrivate::notify_helper (this=0x8d148f0, receiver=0x92271e8, e=0x924ecc0) at kernel/qapplication.cpp:4556
#23 0xb5588e7f in QApplication::notify (this=0x924ecc0, receiver=0x92271e8, e=0x924ecc0) at kernel/qapplication.cpp:3938
#24 0xb64866b1 in KApplication::notify (this=0xbf840550, receiver=0x92271e8, event=0x924ecc0) at ../../kdeui/kernel/kapplication.cpp:311
#25 0xb609b55e in QCoreApplication::notifyInternal (this=0xbf840550, receiver=0x92271e8, event=0x924ecc0) at kernel/qcoreapplication.cpp:915
#26 0xb609f76d in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#27 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8c8dce0) at kernel/qcoreapplication.cpp:1539
#28 0xb609f9ec in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1432
#29 0xb60cd6c4 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#30 postEventSourceDispatch (s=0x8d15b20) at kernel/qeventdispatcher_glib.cpp:279
#31 0xb3fd96d3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#32 0xb3fd9a70 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#33 0xb3fd9b51 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#34 0xb60cd841 in QEventDispatcherGlib::processEvents (this=0x8c8e860, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#35 0xb56371fa in QGuiEventDispatcherGlib::processEvents (this=0x8c8e860, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#36 0xb609a02c in QEventLoop::processEvents (this=this@entry=0xbf83f918, flags=...) at kernel/qeventloop.cpp:149
#37 0xb609a321 in QEventLoop::exec (this=0xbf83f918, flags=...) at kernel/qeventloop.cpp:204
#38 0xb752b4cb in KJob::exec (this=0x9b10150) at ../../kdecore/jobs/kjob.cpp:210
#39 0xb7315e13 in KDevelop::ProjectPrivate::initProjectFiles (this=0xaa78620) at /home/andreas/src/kdevplatform/shell/project.cpp:272
#40 0xb7314129 in KDevelop::Project::open (this=0x9dbcc20, projectFileUrl_=...) at /home/andreas/src/kdevplatform/shell/project.cpp:510
#41 0xb730e3eb in KDevelop::ProjectControllerPrivate::importProject (this=0x8f4d9f8, url_=...) at /home/andreas/src/kdevplatform/shell/projectcontroller.cpp:298
#42 0xb7309ef3 in KDevelop::ProjectController::openProject (this=0x8f65100, projectFile=...) at /home/andreas/src/kdevplatform/shell/projectcontroller.cpp:726
#43 0xb7309314 in KDevelop::ProjectController::openProjects (this=0x8f65100, projects=...) at /home/andreas/src/kdevplatform/shell/projectcontroller.cpp:590
#44 0xb730c65e in KDevelop::ProjectController::qt_static_metacall (_o=0x8f65100, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0x90297a8) at /home/andreas/src/build/kdevplatform/shell/projectcontroller.moc:187
#45 0xb60ad78a in QMetaCallEvent::placeMetaCall (this=0x9046ac8, object=0x8f65100) at kernel/qobject.cpp:525
#46 0xb60b1ccb in QObject::event (this=0x8f65100, e=0x9046ac8) at kernel/qobject.cpp:1195
#47 0xb558447c in QApplicationPrivate::notify_helper (this=0x8d148f0, receiver=0x8f65100, e=0x9046ac8) at kernel/qapplication.cpp:4556
#48 0xb5588e7f in QApplication::notify (this=0x9046ac8, receiver=0x8f65100, e=0x9046ac8) at kernel/qapplication.cpp:3938
#49 0xb64866b1 in KApplication::notify (this=0xbf840550, receiver=0x8f65100, event=0x9046ac8) at ../../kdeui/kernel/kapplication.cpp:311
#50 0xb609b55e in QCoreApplication::notifyInternal (this=0xbf840550, receiver=0x8f65100, event=0x9046ac8) at kernel/qcoreapplication.cpp:915
#51 0xb609f76d in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#52 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8c8dce0) at kernel/qcoreapplication.cpp:1539
#53 0xb609f9ec in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1432
#54 0xb60cd6c4 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#55 postEventSourceDispatch (s=0x8d15b20) at kernel/qeventdispatcher_glib.cpp:279
#56 0xb3fd96d3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#57 0xb3fd9a70 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#58 0xb3fd9b51 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#59 0xb60cd841 in QEventDispatcherGlib::processEvents (this=0x8c8e860, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#60 0xb56371fa in QGuiEventDispatcherGlib::processEvents (this=0x8c8e860, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#61 0xb609a02c in QEventLoop::processEvents (this=this@entry=0xbf840378, flags=...) at kernel/qeventloop.cpp:149
#62 0xb609a321 in QEventLoop::exec (this=0xbf840378, flags=...) at kernel/qeventloop.cpp:204
#63 0xb609fa9a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#64 0xb55822f4 in QApplication::exec () at kernel/qapplication.cpp:3817
#65 0x08057107 in main (argc=5, argv=0xbf840e14) at /home/andreas/src/kdevelop/app/main.cpp:503

Reported using DrKonqi
Comment 1 Aleix Pol 2013-06-12 01:24:35 UTC
Git commit 92d48af35ab73da3f313abb499d63a5da8b92d02 by Aleix Pol.
Committed on 12/06/2013 at 03:24.
Pushed by apol into branch 'master'.

Refactored the QtHelp loading so that it is not synchronous

As it was being done at the moment, we were calling synchronously the qmake
process from the plugin constructor. This was bad and had problems, like
the one discussed in the bug.
Some logic for the lookup is being removed as well, but it seemed like an
overkill to me, the first qmake should be already working. If that's not
the case we can iterate over it.

M  +37   -63   documentation/qthelp/qthelpqtdoc.cpp
M  +6    -0    documentation/qthelp/qthelpqtdoc.h

http://commits.kde.org/kdevelop/92d48af35ab73da3f313abb499d63a5da8b92d02