KDevelop::DUChainLock::lockForWrite: Tried to lock the duchain for writing, but it was already locked for reading here

Peter Oberndorfer kumbayo84 at arcor.de
Mon Oct 6 19:53:09 UTC 2008


Hi,
i get the following error with current kdevplatform/kdevelop
KDevelop::DUChainLock::lockForWrite: Tried to lock the duchain for writing, 
but it was already locked for reading here

how to reproduce:
start kdevelop
open oketa project, open about.cpp
select OketaAboutData::OketaAboutData()
open DUChain viewer
double click the second Context: line
A message box comes up that says kgraphviewer or dotty is not available
(this messagebox is essential for the bug)
wait some time with the messagebox open until duchain cleanup is triggered by 
a timer.
-> assert

A patch for kdevplatform is attached, which seems to solve this problem for 
me.

What i do not fully understand is why there are 2
DUChainReadLocker readLock(DUChain::lock());
in DUChainModel::doubleClicked
and for the above KMessageBox only the inner one of them is released?

So wouldn't it be possible that the same error happens for
KMessageBox::error(0, i18n("Cannot create temporary file...
since the outer lock is still locked?
Do i misunderstand locking?

Greetings Peter
-------------- next part --------------
<BS>kdevelop(6765)/kdevelop (cpp support) CPPParseJob::CPPParseJob: Created job CPPParseJob(0x8c075d0) pp QObject(0x0)  parse QObject(0x0)
kdevelop(6765)/kdevelop (cpp support) PreprocessJob::run: PreprocessJob: preprocessing "/home/kde-devel/kde/include/klocale.h" 
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- PARSING --===>  "/home/kde-devel/kde/include/klocale.h"  
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: building duchain for "/home/kde-devel/kde/include/klocale.h"   
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: ContextBuilder::buildContexts: compiling
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: built top-level context with 0 declarations and 1 included files
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildProxyContextFromContent: ContextBuilder::buildProxyContextFromContent: compiling
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- Parsing finished --===> "/home/kde-devel/kde/include/klocale.h"
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- PARSING --===>  "/home/kde-devel/kde/include/KDE/KLocale"
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: building duchain for "/home/kde-devel/kde/include/KDE/KLocale" 
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: ContextBuilder::buildContexts: compiling
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: built top-level context with 0 declarations and 2 included files
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildProxyContextFromContent: ContextBuilder::buildProxyContextFromContent: compiling
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- Parsing finished --===> "/home/kde-devel/kde/include/KDE/KLocale"
kdevelop(6765)/kdevelop (cpp support) PreprocessJob::sourceNeeded: PreprocessJob "/home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp" : no fitting entry for KUrl("file:///home/kde-devel/kde/include/kdeversion.h") in du-chain, parsing  
kdevelop(6765)/kdevelop (cpp support) CPPParseJob::CPPParseJob: Created job CPPParseJob(0x8b8ea28) pp QObject(0x0)  parse QObject(0x0)
kdevelop(6765)/kdevelop (cpp support) PreprocessJob::run: PreprocessJob: preprocessing "/home/kde-devel/kde/include/kdeversion.h"
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- PARSING --===>  "/home/kde-devel/kde/include/kdeversion.h"
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: building duchain for "/home/kde-devel/kde/include/kdeversion.h"
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: ContextBuilder::buildContexts: compiling
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: built top-level context with 0 declarations and 3 included files
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildProxyContextFromContent: ContextBuilder::buildProxyContextFromContent: compiling
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- Parsing finished --===> "/home/kde-devel/kde/include/kdeversion.h"   
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- PARSING --===>  "/home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp"
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: building duchain for "/home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp" 
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: ContextBuilder::buildContexts: compiling
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildContexts: built top-level context with 5 declarations and 3 included files
kdevelop(6765)/Kate (Document) KateBuffer::doHighlight: HIGHLIGHTED END --- NEED HL, LINESTART:  55  LINEEND:  55  
kdevelop(6765)/Kate (Document) KateBuffer::doHighlight: HL UNTIL LINE:  55  MAX:  55 
kdevelop(6765)/Kate (Document) KateBuffer::doHighlight: HL DYN COUNT:  0  MAX:  512  
kdevelop(6765)/kdevelop (cpp support) CppHighlighting::highlightDUChain: highighting du chain
kdevelop(6765)/kdevelop (cpp support) ContextBuilder::buildProxyContextFromContent: ContextBuilder::buildProxyContextFromContent: compiling
kdevelop(6765)/kdevelop (cpp support) CPPInternalParseJob::run: ===-- Parsing finished --===> "/home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp"
kdevelop(6765)/kdevplatform (language) KDevelop::BackgroundParser::parseComplete: BackgroundParser: parsed "/home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp"   
kdevelop(6765)/kdevplatform (problemreporter) ProblemWidget::parseJobFinished: active document: KUrl("file:///home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp") url: KUrl("file:///home/kde-devel/kde/src/kdeutils/okteta/program/about.cpp")  
kdevelop(6765)/kdevplatform (language) KDevelop::BackgroundParser::parseComplete: Queueing job for deletion CPPParseJob in thread QThread(0x8055748)   
kdevelop(6765)/kdevplatform (language) KDevelop::BackgroundParserPrivate::parseDocumentsInternal: BackgroundParser::parseDocumentsInternal 
kdevelop(6765)/Kate (Document) KateView::slotLostFocus: KateView::slotLostFocus
kdevelop(6765)/Kate (Code Completion) KateCompletionWidget::abortCompletion:   
kdevelop(6765)/kdevplatform DUChainModel::doubleClicked: Wrote dot-graph of context  0x8b995c8  into  "/tmp/kde4-kde-devel/kde-kde-devel/kdevelopwY6765OktetaAboutData.temp.dot"
kdevelop(6765)/kdeui (KNotification) KNotification::slotReceivedId: 0
kdevelop(6765)/kdeui (KNotification) KNotification::close: 0
kdevelop(6765)/kdeui (KNotification) KNotification::~KNotification: -2
kdevelop(6765)/kdevplatform (language) KDevelop::DUChainLock::lockForWrite: Tried to lock the duchain for writing, but it was already locked for reading here:
 "[
0: /home/kde-devel/kde/lib/libkdecore.so.5(_Z14kRealBacktracei+0x3f) [0xb799249f]
1: /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1(_ZN8KDevelop11DUChainLock11lockForReadEj+0x500) [0xb5e6ec50]
2: /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1(_ZN8KDevelop17DUChainReadLocker4lockEv+0x3a) [0xb5e6fafa]
3: /home/kde-devel/kde/lib/libkdevplatformlanguage.so.1(_ZN8KDevelop17DUChainReadLockerC1EPNS_11DUChainLockEj+0x2c) [0xb5e6fb7c]
4: /home/kde-devel/kde/lib/kde4/kdevduchainview.so [0xb2d75bad]
5: /home/kde-devel/kde/lib/kde4/kdevduchainview.so [0xb2d76786]
6: /usr/lib/qt4/libQtCore.so.4(_ZN11QMetaObject8activateEP7QObjectiiPPv+0x1fc) [0xb7e67640]
7: /usr/lib/qt4/libQtCore.so.4(_ZN11QMetaObject8activateEP7QObjectPKS_iPPv+0x4e) [0xb7e67ca2]
8: /usr/lib/qt4/libQtGui.so.4(_ZN17QAbstractItemView13doubleClickedERK11QModelIndex+0x43) [0xb68665a7]
9: /usr/lib/qt4/libQtGui.so.4(_ZN9QTreeView21mouseDoubleClickEventEP11QMouseEvent+0x179) [0xb68af6ed]
10: /usr/lib/qt4/libQtGui.so.4(_ZN7QWidget5eventEP6QEvent+0xa33) [0xb642288d]
11: /usr/lib/qt4/libQtGui.so.4(_ZN6QFrame5eventEP6QEvent+0x2d) [0xb6743eb3]
12: /usr/lib/qt4/libQtGui.so.4(_ZN19QAbstractScrollArea13viewportEventEP6QEvent+0x55) [0xb67d14cb]
13: /usr/lib/qt4/libQtGui.so.4(_ZN17QAbstractItemView13viewportEventEP6QEvent+0x67a) [0xb6874e6c]
14: /usr/lib/qt4/libQtGui.so.4(_ZN9QTreeView13viewportEventEP6QEvent+0x257) [0xb68a8caf]
15: /usr/lib/qt4/libQtGui.so.4 [0xb67d31b0]
16: /usr/lib/qt4/libQtCore.so.4(_ZN23QCoreApplicationPrivate29sendThroughObjectEventFiltersEP7QObjectP6QEvent+0x89) [0xb7e53bc5]
17: /usr/lib/qt4/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x92) [0xb63d405e]
18: /usr/lib/qt4/libQtGui.so.4(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x2d6) [0xb63d8ad8]
19: /home/kde-devel/kde/lib/libkdeui.so.5(_ZN12KApplication6notifyEP7QObjectP6QEvent+0x3a) [0xb769a56a]
20: /usr/lib/qt4/libQtCore.so.4(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0x9d) [0xb7e53789]
21: /usr/lib/qt4/libQtGui.so.4(_ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_E+0x108) [0xb63d8534]
22: /usr/lib/qt4/libQtGui.so.4 [0xb643959c]
23: /usr/lib/qt4/libQtGui.so.4(_ZN12QApplication15x11ProcessEventEP7_XEvent+0xa84) [0xb643808c]
24: /usr/lib/qt4/libQtGui.so.4 [0xb645ce8c]
25: /usr/lib/qt4/libQtCore.so.4(_ZN10QEventLoop13processEventsE6QFlagsINS_17ProcessEventsFlagEE+0x45) [0xb7e52ac1]
26: /usr/lib/qt4/libQtCore.so.4(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x9b) [0xb7e52c39]
27: /usr/lib/qt4/libQtCore.so.4(_ZN16QCoreApplication4execEv+0x9d) [0xb7e54b47]
28: /usr/lib/qt4/libQtGui.so.4(_ZN12QApplication4execEv+0x27) [0xb63d398d]
29: kdevelop [0x804e4c8]
30: /lib/libc.so.6(__libc_start_main+0xe0) [0xb609afc8]
31: kdevelop(_ZN7QWidget10setVisibleEb+0x301) [0x804bc31]
]
"
ASSERT: "d->ownReaderRecursion() == 0" in file /home/kde-devel/kde/src/kdevplatform/language/duchain/duchainlock.cpp, line 273
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kdevelop path = <unknown> pid = 6765
sock_file=/home/kde-devel/.kde4/socket-oberndorfer/kdeinit4__1





Thread 1 (Thread 0xb5b4e6d0 (LWP 6765)):
[KCrash Handler]
#6  0xb7f38410 in __kernel_vsyscall ()
#7  0xb60adf89 in raise () from /lib/libc.so.6
#8  0xb60af571 in abort () from /lib/libc.so.6
#9  0xb7d67847 in qt_message_output () from /usr/lib/qt4/libQtCore.so.4
#10 0xb7d678ff in qFatal () from /usr/lib/qt4/libQtCore.so.4
#11 0xb7d67989 in qt_assert () from /usr/lib/qt4/libQtCore.so.4
#12 0xb5e70256 in KDevelop::DUChainLock::lockForWrite (this=0x810e45c, timeout=300) at /home/kde-devel/kde/src/kdevplatform/language/duchain/duchainlock.cpp:273
#13 0xb5e7058c in KDevelop::DUChainWriteLocker::lock (this=0xbff1000c) at /home/kde-devel/kde/src/kdevplatform/language/duchain/duchainlock.cpp:392
#14 0xb5e7062f in DUChainWriteLocker (this=0xbff1000c, duChainLock=0x810e45c, timeout=300) at /home/kde-devel/kde/src/kdevplatform/language/duchain/duchainlock.cpp:377
#15 0xb5e23781 in KDevelop::DUChainPrivate::doMoreCleanup (this=0x810e450, force=false) at /home/kde-devel/kde/src/kdevplatform/language/duchain/duchain.cpp:314
#16 0xb5e15d73 in KDevelop::DUChain::cleanup (this=0x8231288) at /home/kde-devel/kde/src/kdevplatform/language/duchain/duchain.cpp:309
#17 0xb5e161ce in KDevelop::DUChain::qt_metacall (this=0x8231288, _c=QMetaObject::InvokeMetaMethod, _id=11, _a=0xbff10118) at /home/kde-devel/kde/build/kdevplatform/language/duchain.moc:135
#18 0xb7e67640 in QMetaObject::activate () from /usr/lib/qt4/libQtCore.so.4
#19 0xb7e67ca2 in QMetaObject::activate () from /usr/lib/qt4/libQtCore.so.4
#20 0xb7ea120d in QTimer::timeout () from /usr/lib/qt4/libQtCore.so.4
#21 0xb7e6e1dc in QTimer::timerEvent () from /usr/lib/qt4/libQtCore.so.4
#22 0xb7e62f20 in QObject::event () from /usr/lib/qt4/libQtCore.so.4
#23 0xb63d407e in QApplicationPrivate::notify_helper () from /usr/lib/qt4/libQtGui.so.4
#24 0xb63d88af in QApplication::notify () from /usr/lib/qt4/libQtGui.so.4
#25 0xb769a56a in KApplication::notify (this=0xbff11dd4, receiver=0x8101f30, event=0xbff10618) at /home/kde-devel/kde/src/kdelibs/kdeui/kernel/kapplication.cpp:307
#26 0xb7e53789 in QCoreApplication::notifyInternal () from /usr/lib/qt4/libQtCore.so.4
#27 0xb7e7d66e in QTimerInfoList::activateTimers () from /usr/lib/qt4/libQtCore.so.4
#28 0xb7e7d779 in QEventDispatcherUNIX::activateTimers () from /usr/lib/qt4/libQtCore.so.4
#29 0xb7e7e2df in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/libQtCore.so.4
#30 0xb645cf0f in QEventDispatcherX11::processEvents () from /usr/lib/qt4/libQtGui.so.4
#31 0xb7e52ac1 in QEventLoop::processEvents () from /usr/lib/qt4/libQtCore.so.4
#32 0xb7e52c39 in QEventLoop::exec () from /usr/lib/qt4/libQtCore.so.4
#33 0xb6815d11 in QDialog::exec () from /usr/lib/qt4/libQtGui.so.4
#34 0xb7604eba in KMessageBox::createKMessageBox (dialog=0x8bb1be8, icon=@0xbff10a58, text=@0xbff10c1c, strlist=@0xbff10b2c, ask=@0xbff10ae4, checkboxReturn=0x0, options=@0xbff10a54, 
details=@0xbff10adc, notifyType=QMessageBox::Critical) at /home/kde-devel/kde/src/kdelibs/kdeui/dialogs/kmessagebox.cpp:314
#35 0xb7605e0f in KMessageBox::createKMessageBox (dialog=0x8bb1be8, icon=QMessageBox::Critical, text=@0xbff10c1c, strlist=@0xbff10b2c, ask=@0xbff10ae4, checkboxReturn=0x0, options=@0xbff10ae0, 
details=@0xbff10adc) at /home/kde-devel/kde/src/kdelibs/kdeui/dialogs/kmessagebox.cpp:150
#36 0xb7607171 in KMessageBox::errorListWId (parent_id=0, text=@0xbff10c1c, strlist=@0xbff10b2c, caption=@0xbff10c18, options=@0xbff10b28)
at /home/kde-devel/kde/src/kdelibs/kdeui/dialogs/kmessagebox.cpp:832
#37 0xb76073c1 in KMessageBox::error (parent=0x0, text=@0xbff10c1c, caption=@0xbff10c18, options=@0xbff10c14) at /home/kde-devel/kde/src/kdelibs/kdeui/dialogs/kmessagebox.cpp:796

 ---> here readLock is taken <---
#38 0xb2d76630 in DUChainModel::doubleClicked (this=0x84bc1b0, index=@0x8b8ec58) at /home/kde-devel/kde/src/kdevplatform/plugins/duchainviewer/duchainmodel.cpp:560
#39 0xb2d76786 in DUChainModel::qt_metacall (this=0x84bc1b0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbff10d5c)
at /home/kde-devel/kde/build/kdevplatform/plugins/duchainviewer/duchainmodel.moc:74
#40 0xb7e67640 in QMetaObject::activate () from /usr/lib/qt4/libQtCore.so.4
#41 0xb7e67ca2 in QMetaObject::activate () from /usr/lib/qt4/libQtCore.so.4
#42 0xb68665a7 in QAbstractItemView::doubleClicked () from /usr/lib/qt4/libQtGui.so.4
#43 0xb68af6ed in QTreeView::mouseDoubleClickEvent () from /usr/lib/qt4/libQtGui.so.4
#44 0xb642288d in QWidget::event () from /usr/lib/qt4/libQtGui.so.4
#45 0xb6743eb3 in QFrame::event () from /usr/lib/qt4/libQtGui.so.4
#46 0xb67d14cb in QAbstractScrollArea::viewportEvent () from /usr/lib/qt4/libQtGui.so.4
#47 0xb6874e6c in QAbstractItemView::viewportEvent () from /usr/lib/qt4/libQtGui.so.4
#48 0xb68a8caf in QTreeView::viewportEvent () from /usr/lib/qt4/libQtGui.so.4
#49 0xb67d31b0 in QAbstractScrollAreaFilter::eventFilter () from /usr/lib/qt4/libQtGui.so.4
#50 0xb7e53bc5 in QCoreApplicationPrivate::sendThroughObjectEventFilters () from /usr/lib/qt4/libQtCore.so.4
#51 0xb63d405e in QApplicationPrivate::notify_helper () from /usr/lib/qt4/libQtGui.so.4
#52 0xb63d8ad8 in QApplication::notify () from /usr/lib/qt4/libQtGui.so.4
#53 0xb769a56a in KApplication::notify (this=0xbff11dd4, receiver=0x8236618, event=0xbff117a0) at /home/kde-devel/kde/src/kdelibs/kdeui/kernel/kapplication.cpp:307
#54 0xb7e53789 in QCoreApplication::notifyInternal () from /usr/lib/qt4/libQtCore.so.4
#55 0xb63d8534 in QApplicationPrivate::sendMouseEvent () from /usr/lib/qt4/libQtGui.so.4
#56 0xb643959c in QETWidget::translateMouseEvent () from /usr/lib/qt4/libQtGui.so.4
#57 0xb643808c in QApplication::x11ProcessEvent () from /usr/lib/qt4/libQtGui.so.4
#58 0xb645ce8c in QEventDispatcherX11::processEvents () from /usr/lib/qt4/libQtGui.so.4
#59 0xb7e52ac1 in QEventLoop::processEvents () from /usr/lib/qt4/libQtCore.so.4
#60 0xb7e52c39 in QEventLoop::exec () from /usr/lib/qt4/libQtCore.so.4
#61 0xb7e54b47 in QCoreApplication::exec () from /usr/lib/qt4/libQtCore.so.4
#62 0xb63d398d in QApplication::exec () from /usr/lib/qt4/libQtGui.so.4
#63 0x0804e4c8 in main (argc=1, argv=0xbff12234) at /home/kde-devel/kde/src/kdevelop/src/main.cpp:194
-------------- next part --------------
A non-text attachment was scrubbed...
Name: duchainmodel_lock_fix.diff
Type: text/x-diff
Size: 506 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20081006/7c9ccd00/attachment.bin>


More information about the KDevelop-devel mailing list