Bug 88091 - Upon closing a project kdevelop locks up dcop until kdevelop is killed
Summary: Upon closing a project kdevelop locks up dcop until kdevelop is killed
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: 3.1
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-26 01:19 UTC by Florian Schanda
Modified: 2006-03-14 22:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Black magic patch, do not apply for real (4.91 KB, patch)
2004-08-27 22:18 UTC, Florian Schanda
Details
Sane Patch (415 bytes, patch)
2004-08-27 23:04 UTC, Florian Schanda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Schanda 2004-08-26 01:19:53 UTC
Version:           3.1 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 3.3.4 
OS:                Linux

Well, this one is certainly strange:

If I close any project by
Comment 1 Florian Schanda 2004-08-26 01:22:08 UTC
Whoops, pressed tab+space.

If I close any project by
  - closing kdevelop
  - opening a new project
  - choosing "close project" from the project menu

kdevelop hangs. Plus some other apps like konqueror. I also tried dcop - it also hangs. Killing kdevelop (temporarily) solves the problem and everything else starts working again.
Comment 2 Amilcar do Carmo Lucas 2004-08-26 10:36:30 UTC
I can confirm this in HEAD.
Comment 3 Florian Schanda 2004-08-27 00:07:34 UTC
Recompiled kdevelop HEAD with debug and everything; this is the output I get (I hope it formats well...):

kdevelop (core): dcop emitting project closed
kio (KDirWatch): WARNING: KDirWatch::removeDir can't handle ''
kdevelop (cpp support): projectClosed( )
kdevelop (core): [void PartController::slotActivePartChanged(KParts::Part*)]
kdevelop (abbrev): AbbrevPart::slotActivePartChanged()
kdevelop: KonsoleViewWidget::activePartChanged()
kdevelop:  ===> Changing dir to /work/programming/siedler/ksiedler
kdevelop: KonsoleViewWidget::setDirectory()
kdevelop:  ===> part is 0
qeditor: CppSupportPart::activePartChanged()
kdevelop: ClassViewPart::activePartChanged()
kdevelop (cpp support): CppCodeCompletion::slotActivePartChanged()
kdevelop (debugger): GDBController::slotStopDebugger() called
kdevelop (debugger): Disassemble widget active: false
kdevelop (cpp support): DistpartPart::~DistpartPart()
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [BookmarksWidget pointer (0x8621b78) to widget bookmarks widget, geometry=118x80+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x85bd648) to widget bookmarks widget, geometry=118x92+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [ClassViewWidget pointer (0x863c538) to widget ClassViewWidget, geometry=118x80+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x8625970) to widget ClassViewWidget, geometry=118x92+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [FileGroupsWidget pointer (0x8662668) to widget file view widget, geometry=118x80+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x86676c8) to widget file view widget, geometry=118x92+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [GDBDebugger::VariableWidget pointer (0x8672348) to widget variablewidget, geometry=172x135+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x86713e8) to widget variablewidget, geometry=172x147+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [GDBDebugger::GDBBreakpointWidget pointer (0x8686ed0) to widget gdbBreakpointWidget, geometry=140x84+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x868a6f0) to widget gdbBreakpointWidget, geometry=140x96+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [GDBDebugger::FramestackWidget pointer (0x8694378) to widget framestackWidget, geometry=800x480+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [GDBDebugger::DisassembleWidget pointer (0x869b0e0) to widget disassembleWidget, geometry=800x480+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [GDBDebugger::GDBOutputWidget pointer (0x86bf370) to widget gdbOutputWidget, geometry=800x480+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [CTags2Widget pointer (0x86da2a8) to widget CTags2WidgetBase, geometry=483x118+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x86e0548) to widget CTags2WidgetBase, geometry=483x130+0+0]
kdevelop (core): [virtual void NewMainWindow::removeView(QWidget*)]  - view: [PartWidget pointer (0x870b0f0) to widget fileviewpartwidget, geometry=118x106+0+12]
kdevelop (core): parentWidget: [KDockWidget pointer (0x87152b8) to widget fileviewpartwidget, geometry=118x118+0+0]
kdevelop (file view): FileTreeWidget::~FileTreeWidget()
kdevelop (file view): StdFileTreeWidgetImpl::~StdFileTreeWidgetImpl()
kdevelop (file view): FileTreeViewWidgetImpl::~FileTreeViewWidgetImpl()
kdevelop (core): Language support for KDevCppSupport unloading...
kdevelop (cpp support): !!!!!!!!!!!!!!!!!! BG PARSER DESTROYED !!!!!!!!!!!!

After that, it hangs. I haven't looked at the code yet, but I think the excessive exclamation marks might indicate a problem ;)
Comment 4 Florian Schanda 2004-08-27 14:05:17 UTC
In src/projectmanager.cpp, ~line 351
in the public slot bool closeProject( bool exiting = false )

execution does not return from the function call unloadLanguageSupport();

...investigating further.
Comment 5 Florian Schanda 2004-08-27 14:38:47 UTC
This seems to be caused by some kind of deadlock in
languages/cpp/backgroundparser.cpp in the public member function void close()

In particular, we are stuck in this loop:

    while (running()) {
        sleep(1);
    }

Can somebody who wrote this, comment on it?
Thanks in advance
Comment 6 LiuCougar 2004-08-27 18:24:58 UTC
I have exactly the same bug with version kdevelop 3.1.0

have any idea how to workaround this bug? It is really annoying.

Thanks
Comment 7 Florian Schanda 2004-08-27 22:16:38 UTC
Whilst playing around and adding more random kdDebug() statements, it suddenly
worked.

Consider this an ultra-dodgy workaround - I have no idea why is should work.

Perhaps a compiler bug; the extra kdDebug() force gcc to generate different code? I really have no idea. I guess (I haven't tried yet) you need to configure with --enable-debug for this to work...
Comment 8 Florian Schanda 2004-08-27 22:18:24 UTC
Created attachment 7324 [details]
Black magic patch, do not apply for real

I somebody could confirm if this works for other configurations, and more
importantly, WHY...
Comment 9 Florian Schanda 2004-08-27 23:04:43 UTC
Created attachment 7325 [details]
Sane Patch

Calling QThread::exit() at the end of run() is unnecessary, I think. The QT
docs state that returning is enough to terminate the thread and will also wake
up anybody waiting for that.

This makes it work, even without debug. Somebody with cvs access, please review
& apply.
Comment 10 LiuCougar 2004-08-30 03:20:06 UTC
no, my kdevelop still crash even with this patch applied :(
Comment 11 LiuCougar 2004-08-30 18:29:35 UTC
after --enable-debug and recompile, no crash any more when closing project! Even without the patch!

Comment 12 nivek98 2005-03-09 01:46:37 UTC
The Patch fixed the problem for me.  I think i still had --enable-debug=full on though, not sure if that matters.
Comment 13 Engin AYDOGAN 2005-09-30 03:23:52 UTC
With a week (or so) old SVN co from branch 3.5 I have this freeze problem upon exit/close project too. Here's my bt:

#0  0x0029c402 in ?? ()
#1  0x0040da1c in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x0234fb80 in QThread::exit () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#3  0x0234fbee in QThread::sleep () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#4  0x0107b5c6 in BackgroundParser::close () from /opt/kde/cvs/lib/kde3/libkdevcppsupport.so
#5  0x01049db2 in CppSupportPart::~CppSupportPart$delete ()
   from /opt/kde/cvs/lib/kde3/libkdevcppsupport.so
#6  0x069b357c in ProjectManager::unloadLanguageSupport () from /opt/kde/cvs/lib/libkdevshell.so.0
#7  0x069b502f in ProjectManager::closeProject () from /opt/kde/cvs/lib/libkdevshell.so.0
#8  0x069b8d31 in ProjectManager::qt_invoke () from /opt/kde/cvs/lib/libkdevshell.so.0
#9  0x023bbdb4 in QObject::activate_signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#10 0x023bc274 in QObject::activate_signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#11 0x063f4eb3 in KAction::activated (this=0x97ba028)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdeui/kaction.moc:176
#12 0x063f5cd9 in KAction::slotActivated (this=0x97ba028)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdeui/kaction.cpp:1102
#13 0x063f8e71 in KAction::slotPopupActivated (this=0x97ba028)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdeui/kaction.cpp:1129
#14 0x063f91f5 in KAction::qt_invoke (this=0x97ba028, _id=16, _o=0xbfc6a134)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdeui/kaction.moc:219
#15 0x023bbdb4 in QObject::activate_signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#16 0x02730796 in QSignal::signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#17 0x023d9633 in QSignal::activate () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x024d0582 in QPopupMenu::mouseReleaseEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x063e34f3 in KPopupMenu::mouseReleaseEvent (this=0x97d66e0, e=0xbfc6a664)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdeui/kpopupmenu.cpp:511
#20 0x023fa127 in QWidget::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#21 0x0235708d in QApplication::internalNotify () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#22 0x02357fef in QApplication::notify () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#23 0x060ecf1e in KApplication::notify (this=0xbfc6aa14, receiver=0x97d66e0, event=0xbfc6a664)
    at /home/engin/kdev/kde-svn/KDE/3.5/kdelibs/kdecore/kapplication.cpp:550
#24 0x022eeb0d in QETWidget::translateMouseEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x022eceb3 in QApplication::x11ProcessEvent () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#26 0x02300fc8 in QEventLoop::processEvents () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#27 0x0236f732 in QEventLoop::enterLoop () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x0236f656 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#29 0x02356a59 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#30 0x0804e157 in main ()
Comment 14 Kashif Shaikh 2005-12-16 21:39:12 UTC
I just downloaded and built kdevelop 3.3 and kde 3.5 via konstruct using standard all default garconf build options/flags.  

I have the same problem with kdevelop hanging after closing a C project or quiting kdevelop with an open C project.

Applying the "Sane Patch" and rebuilding kdevelop fixed hanging problem. Case closed in my book, I can continue on to enjoy kde3.5 & kdevelop.

Kashif
Comment 15 Alexander Dymo 2006-03-14 22:58:13 UTC
SVN commit 518688 by dymo:

Applied patch from Florian Schanda: don't crash at exit.
BUG: 88091



 M  +2 -1      backgroundparser.cpp  


--- branches/kdevelop/3.4/languages/cpp/backgroundparser.cpp #518687:518688
@@ -399,7 +399,8 @@
 	
 	kdDebug( 9007 ) << "!!!!!!!!!!!!!!!!!! BG PARSER DESTROYED !!!!!!!!!!!!" << endl;
 	
-	QThread::exit();
+//	adymo: commented to fix #88091
+//	QThread::exit();
 }
 
 //kate: indent-mode csands; tab-width 4; space-indent off;