Bug 230692 - KDevelop crashed when closing
Summary: KDevelop crashed when closing
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unclassified
Component: kdecore (show other bugs)
Version: unspecified
Platform: Archlinux Packages Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 306951 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-14 12:21 UTC by Bernhard Beschow
Modified: 2013-02-08 11:31 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Beschow 2010-03-14 12:21:54 UTC
Application: kdevelop (3.9.99 (using KDevPlatform 0.9.99))
KDE Platform Version: 4.4.1 (KDE 4.4.1)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-ARCH i686
Distribution (Platform): Archlinux Packages

-- Information about the crash:
KDevelop crashed when I was closing it and a build job was still active in the background.

The crash can be reproduced some of the time.

 -- Backtrace:
Application: KDevelop (kdevelop.bin), signal: Segmentation fault
[Current thread is 1 (Thread 0xb4519710 (LWP 4001))]

Thread 6 (Thread 0xb0f56b70 (LWP 4005)):
#0  0xb77ed424 in __kernel_vsyscall ()
#1  0xb616c182 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb6256654 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3  0xb6e7113f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb52cb435 in KDevelop::DUChainPrivate::CleanupThread::run() () from /usr/lib/libkdevplatformlanguage.so.1
#5  0xb6e7027e in ?? () from /usr/lib/libQtCore.so.4
#6  0xb61678ac in start_thread () from /lib/libpthread.so.0
#7  0xb624901e in clone () from /lib/libc.so.6

Thread 5 (Thread 0xaffb1b70 (LWP 4006)):
#0  0xb77ed424 in __kernel_vsyscall ()
#1  0xb616be55 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb62565fd in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3  0xb6e711b7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb47beff0 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x8cae9a8, th=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:365
#5  0xb47c1abc in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0x8b337e8, th=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:80
#6  0xb47bd9ab in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0x8cae9a8, th=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:356
#7  0xb47c1bb2 in ThreadWeaver::WorkingHardState::applyForWork (this=0x8b337e8, th=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:71
#8  0xb47bf273 in ThreadWeaver::WeaverImpl::applyForWork (this=0x8cae9a8, th=0x8a64c18, previous=0x8b48a98) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:351
#9  0xb47bfc4e in ThreadWeaver::ThreadRunHelper::run (this=0xaffb12f4, parent=0x8cae9a8, th=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:87
#10 0xb47c036b in ThreadWeaver::Thread::run (this=0x8a64c18) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:142
#11 0xb6e7027e in ?? () from /usr/lib/libQtCore.so.4
#12 0xb61678ac in start_thread () from /lib/libpthread.so.0
#13 0xb624901e in clone () from /lib/libc.so.6

Thread 4 (Thread 0xab9e1b70 (LWP 4115)):
#0  0xb77ed424 in __kernel_vsyscall ()
#1  0xb616be55 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb62565fd in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3  0xb4a9b2a7 in ?? () from /usr/lib/libQtScript.so.4
#4  0xb4a9b2f1 in ?? () from /usr/lib/libQtScript.so.4
#5  0xb61678ac in start_thread () from /lib/libpthread.so.0
#6  0xb624901e in clone () from /lib/libc.so.6

Thread 3 (Thread 0xa7595b70 (LWP 4149)):
#0  0xb77ed424 in __kernel_vsyscall ()
#1  0xb616be55 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb62565fd in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3  0xb6e711b7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb47beff0 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x882bd08, th=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:365
#5  0xb47c1abc in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0x885e580, th=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:80
#6  0xb47bd9ab in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0x882bd08, th=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:356
#7  0xb47c1bb2 in ThreadWeaver::WorkingHardState::applyForWork (this=0x885e580, th=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:71
#8  0xb47bf273 in ThreadWeaver::WeaverImpl::applyForWork (this=0x882bd08, th=0x949fe60, previous=0xa536f80) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:351
#9  0xb47bfc4e in ThreadWeaver::ThreadRunHelper::run (this=0xa75952f4, parent=0x882bd08, th=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:87
#10 0xb47c036b in ThreadWeaver::Thread::run (this=0x949fe60) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:142
#11 0xb6e7027e in ?? () from /usr/lib/libQtCore.so.4
#12 0xb61678ac in start_thread () from /lib/libpthread.so.0
#13 0xb624901e in clone () from /lib/libc.so.6

Thread 2 (Thread 0xa6d94b70 (LWP 4150)):
#0  0xb77ed424 in __kernel_vsyscall ()
#1  0xb616be55 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb62565fd in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libc.so.6
#3  0xb6e711b7 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#4  0xb47beff0 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x882bd08, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:365
#5  0xb47c1abc in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0x885e580, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:80
#6  0xb47bd9ab in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0x882bd08, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:356
#7  0xb47c1bb2 in ThreadWeaver::WorkingHardState::applyForWork (this=0x885e580, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:71
#8  0xb47bf273 in ThreadWeaver::WeaverImpl::applyForWork (this=0x882bd08, th=0x952c280, previous=0x0) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:351
#9  0xb47c1bd1 in ThreadWeaver::WorkingHardState::applyForWork (this=0x885e580, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:74
#10 0xb47bf273 in ThreadWeaver::WeaverImpl::applyForWork (this=0x882bd08, th=0x952c280, previous=0x0) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:351
#11 0xb47c1bd1 in ThreadWeaver::WorkingHardState::applyForWork (this=0x885e580, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WorkingHardState.cpp:74
#12 0xb47bf273 in ThreadWeaver::WeaverImpl::applyForWork (this=0x882bd08, th=0x952c280, previous=0x887d020) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/WeaverImpl.cpp:351
#13 0xb47bfc4e in ThreadWeaver::ThreadRunHelper::run (this=0xa6d942f4, parent=0x882bd08, th=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:87
#14 0xb47c036b in ThreadWeaver::Thread::run (this=0x952c280) at /tmp/kdelibs/src/kdelibs-4.4.1/threadweaver/Weaver/Thread.cpp:142
#15 0xb6e7027e in ?? () from /usr/lib/libQtCore.so.4
#16 0xb61678ac in start_thread () from /lib/libpthread.so.0
#17 0xb624901e in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb4519710 (LWP 4001)):
[KCrash Handler]
#6  0x00000000 in ?? ()
#7  0xb764ee76 in qDeleteAll<QList<KJob*>::const_iterator> (this=0xa425f170, __in_chrg=<value optimized out>) at /usr/include/QtCore/qalgorithms.h:322
#8  qDeleteAll<QList<KJob*> > (this=0xa425f170, __in_chrg=<value optimized out>) at /usr/include/QtCore/qalgorithms.h:330
#9  ~KCompositeJobPrivate (this=0xa425f170, __in_chrg=<value optimized out>) at /tmp/kdelibs/src/kdelibs-4.4.1/kdecore/jobs/kcompositejob.cpp:29
#10 0xb764fd54 in ~KJob (this=0xa42e6738, __in_chrg=<value optimized out>) at /tmp/kdelibs/src/kdelibs-4.4.1/kdecore/jobs/kjob.cpp:69
#11 0xb764eb78 in ~KCompositeJob (this=0xa42e6738, __in_chrg=<value optimized out>) at /tmp/kdelibs/src/kdelibs-4.4.1/kdecore/jobs/kcompositejob.cpp:44
#12 0xace0267d in BuildItemBuilderJob::~BuildItemBuilderJob() () from /usr/lib/kde4/kdevprojectmanagerview.so
#13 0xb6f80df5 in qDeleteInEventHandler(QObject*) () from /usr/lib/libQtCore.so.4
#14 0xb6f82508 in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#15 0xb64d85dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#16 0xb64df1ee in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0xb725205a in KApplication::notify (this=0xbfe719a4, receiver=0xa42e6738, event=0xa36aad8) at /tmp/kdelibs/src/kdelibs-4.4.1/kdeui/kernel/kapplication.cpp:302
#18 0xb6f71cbb in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#19 0xb6f74693 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#20 0xb6f747fd in QCoreApplication::sendPostedEvents(QObject*, int) () from /usr/lib/libQtCore.so.4
#21 0xb6f9dadf in ?? () from /usr/lib/libQtCore.so.4
#22 0xb4f19378 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#23 0xb4f1cbf0 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#24 0xb4f1cd23 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#25 0xb6f9d5d5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#26 0xb6594ae5 in ?? () from /usr/lib/libQtGui.so.4
#27 0xb6f702f9 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#28 0xb6f7074a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#29 0xb6f748bf in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#30 0xb64d8677 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#31 0x0804f8c3 in _start ()

Possible duplicates by query: bug 209536, bug 206569, bug 202091.

Reported using DrKonqi
Comment 1 Andreas Pakulat 2010-03-14 14:08:37 UTC
Hmm, seems like something else needs fixing in kdelibs. I can't see anything wrong in kdevelop's code. We're properly registering the buildjob with the runcontroller, which in turn stops all running job during shutdown. As the kde and kdevelop versions suggest that the OP has the fixes from bug 206569 and bug 202091 and the backtrace is deep inside kdelibs code I'm re-assigning.
Comment 2 Asen Lekov 2011-11-24 18:02:17 UTC
Could be related to bug 229982
Comment 3 Myriam Schweingruber 2011-11-25 21:11:16 UTC
(In reply to comment #2)
> Could be related to bug 229982

No
Comment 4 Kevin Funk 2013-02-04 07:52:33 UTC
Just had the exact same crash:

#0  0x00000000093ec0c8 in ?? ()                                                                                                                                                                            
#1  0x00007ffff7a3f28e in qDeleteAll<QList<KJob*>::const_iterator> (end=..., begin=...)                                                                                                                    
    at /usr/include/qt4/QtCore/qalgorithms.h:322                                                                                                                                                           
#2  qDeleteAll<QList<KJob*> > (c=QList<KJob *> = {...}) at /usr/include/qt4/QtCore/qalgorithms.h:330                                                                                                       
#3  KCompositeJobPrivate::~KCompositeJobPrivate (this=0x8849850, __in_chrg=<optimized out>)                                                                                                                
    at ../../kdecore/jobs/kcompositejob.cpp:29                                                                                                                                                             
#4  0x00007ffff7a3f2c9 in KCompositeJobPrivate::~KCompositeJobPrivate (this=0x8849850, __in_chrg=<optimized out>)
    at ../../kdecore/jobs/kcompositejob.cpp:30
#5  0x00007ffff7a3fd70 in KJob::~KJob (this=0x880b030, __in_chrg=<optimized out>) at ../../kdecore/jobs/kjob.cpp:73
#6  0x00007ffff1a8e5d9 in KDevelop::BuilderJob::~BuilderJob (this=0x880b030, __in_chrg=<optimized out>)
    at /home/krf/devel/src/kdevplatform/project/builderjob.cpp:158
Comment 5 Kevin Funk 2013-02-04 07:53:47 UTC
The fix would be to connect do QObject::destroyed signals when adding subjobs in KCompositeJob. If this signal is catched, remove the job from the list.

Do you see any objections against this? Otherwise I'll prepare a patch for this.
Comment 6 Kevin Funk 2013-02-05 13:33:43 UTC
Review-request: https://git.reviewboard.kde.org/r/108770/ 

After discussion it turned out that the real issue is that KCompositeJob doesn't support sub jobs being killed Quietly (which is the default for KJob::kill()). Unfortunately this is not stated in the API docs.

Will prepare a patch for KDevelop if possible.
Comment 7 Kevin Funk 2013-02-05 14:13:15 UTC
*** Bug 306951 has been marked as a duplicate of this bug. ***
Comment 8 Kevin Funk 2013-02-07 07:31:36 UTC
Git commit 6dc74176dab5d4a34d05cfa9c6d89b77a7ec37e2 by Kevin Funk.
Committed on 05/02/2013 at 16:35.
Pushed by kfunk into branch 'master'.

Fix double-free in ~KCompositeJobPrivate

In case a subjob of KCompositeJob has been deleted, this KCompositeJob
instance will crash as soon as it is being destructed, trying to delete
this subjob again. The reason for this is that KCompositeJob::addSubjob()
does not change the ownership of @p job. So, this job could be still
deleted by ~QObject() by the original parent.

Add tests for this corner case.

This fixes a bug in KDevelop.

Backtrace:
1 0x00007ffff7a3f28e in qDeleteAll<QList<KJob*>::const_iterator>
(end=..., begin=...) at /usr/include/qt4/QtCore/qalgorithms.h:322
2 qDeleteAll<QList<KJob*> > (c=QList<KJob *> = {...}) at
/usr/include/qt4/QtCore/qalgorithms.h:330 #3
KCompositeJobPrivate::~KCompositeJobPrivate (this=0x8849850,
__in_chrg=<optimized out>) at ../../kdecore/jobs/kcompositejob.cpp:29
4 0x00007ffff7a3f2c9 in KCompositeJobPrivate::~KCompositeJobPrivate
(this=0x8849850, __in_chrg=<optimized out>) at
../../kdecore/jobs/kcompositejob.cpp:30
5 0x00007ffff7a3fd70 in KJob::~KJob (this=0x880b030,
__in_chrg=<optimized out>) at
../../kdecore/jobs/kjob.cpp:73
6 0x00007ffff1a8e5d9 in KDevelop::BuilderJob::~BuilderJob
(this=0x880b030, __in_chrg=<optimized
out>) at /home/krf/devel/src/kdevplatform/project/builderjob.cpp:158
REVIEW: 108770
FIXED-IN: 4.11

M  +5    -2    kdecore/jobs/kcompositejob.cpp
M  +8    -1    kdecore/jobs/kcompositejob.h
M  +5    -0    kdecore/tests/CMakeLists.txt
A  +107  -0    kdecore/tests/kcompositejobtest.cpp     [License: LGPL (v2)]
A  +70   -0    kdecore/tests/kcompositejobtest.h     [License: LGPL (v2)]

http://commits.kde.org/kdelibs/6dc74176dab5d4a34d05cfa9c6d89b77a7ec37e2
Comment 9 Kevin Funk 2013-02-08 11:31:53 UTC
Git commit 917a979724a5feae93406cfbaf82042af082124f by Kevin Funk.
Committed on 08/02/2013 at 11:26.
Pushed by kfunk into branch '1.5'.

Fix parenting in BuilderJob::addSubjob()

Fixes a bug in kdelibs, which is fixed in KDE 4.11.
At this point we can easily work-around this issue.
See cc'ed bug for explanation(s).

This fixes a crash-on-exit with a build running.

REVIEW: 108848

M  +16   -0    project/builderjob.cpp
M  +4    -0    project/builderjob.h

http://commits.kde.org/kdevplatform/917a979724a5feae93406cfbaf82042af082124f