Bug 316669

Summary: Kdevelop crashes while background parsing a project
Product: [Applications] kdevelop Reporter: emil.ostwald
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, yusefmhg
Priority: NOR    
Version: 4.4.1   
Target Milestone: 4.3.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description emil.ostwald 2013-03-13 14:18:56 UTC
Application: kdevelop (4.4.1)
KDE Platform Version: 4.10.1 "release 552"
Qt Version: 4.8.4
Operating System: Linux 3.4.33-2.24-desktop x86_64
Distribution: "openSUSE 12.2 (x86_64)"

-- Information about the crash:
While parsing a project kdevelop crashes. Parsing crashes only for some projects, but I cannot see any pattern here.

The crash can be reproduced every time.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fdf77a62780 (LWP 12185))]

Thread 10 (Thread 0x7fdf5d2fe700 (LWP 12187)):
#0  0x00007fdf73f25c61 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fdf7551b577 in wait (time=1000, this=0x2b5a3b0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x2b886b0, time=1000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fdf7167b77b in ?? () from /usr/lib64/libkdevplatformlanguage.so.6
#4  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x2b88690) at thread/qthread_unix.cpp:338
#5  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#6  0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 9 (Thread 0x7fdf449ac700 (LWP 12212)):
#0  0x00007fdf74226b30 in pthread_mutex_unlock () from /lib64/libc.so.6
#1  0x00007fdf6e24d4a1 in g_mutex_unlock () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fdf6e210eb5 in g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fdf6e2115ab in ?? () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fdf6e2117a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#5  0x00007fdf75645166 in QEventDispatcherGlib::processEvents (this=0x7fdf400008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007fdf7561597f in QEventLoop::processEvents (this=this@entry=0x7fdf449abe00, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007fdf75615c08 in QEventLoop::exec (this=0x7fdf449abe00, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007fdf755180e0 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#9  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x361b110) at thread/qthread_unix.cpp:338
#10 0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#11 0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 8 (Thread 0x7fdf3e6b5700 (LWP 12222)):
#0  0x00007fdf7421214f in poll () from /lib64/libc.so.6
#1  0x00007fdf6e211684 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fdf6e2117a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fdf75645166 in QEventDispatcherGlib::processEvents (this=0x7fdf380008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#4  0x00007fdf7561597f in QEventLoop::processEvents (this=this@entry=0x7fdf3e6b4dd0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fdf75615c08 in QEventLoop::exec (this=0x7fdf3e6b4dd0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007fdf755180e0 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#7  0x00007fdf755f60ef in QInotifyFileSystemWatcherEngine::run (this=0x420b340) at io/qfilesystemwatcher_inotify.cpp:256
#8  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x420b340) at thread/qthread_unix.cpp:338
#9  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#10 0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7fdf3deb4700 (LWP 12239)):
#0  0x00007fdf73f258f4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fdf709f3247 in ?? () from /usr/lib64/libQtScript.so.4
#2  0x00007fdf709f3279 in ?? () from /usr/lib64/libQtScript.so.4
#3  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#4  0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7fdf377fe700 (LWP 12570)):
#0  0x00007fdf73f258f4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fdf7551b61b in wait (time=18446744073709551615, this=0x533ce10) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x5315540, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fdf6b30a971 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x53481b0, th=0x530fad0) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/WeaverImpl.cpp:365
#4  0x00007fdf6b30d1bb in ThreadWeaver::WorkingHardState::applyForWork (this=0x531ced0, th=0x530fad0) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/WorkingHardState.cpp:71
#5  0x00007fdf6b30c02f in ThreadWeaver::ThreadRunHelper::run (this=this@entry=0x7fdf377fde00, parent=0x53481b0, th=th@entry=0x530fad0) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:87
#6  0x00007fdf6b30c0bb in ThreadWeaver::Thread::run (this=0x530fad0) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:142
#7  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x530fad0) at thread/qthread_unix.cpp:338
#8  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#9  0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7fdf37fff700 (LWP 12571)):
#0  0x00007fdf73f258f4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fdf6a8d7437 in ?? () from /usr/lib64/libQtWebKit.so.4
#2  0x00007fdf6a8d7469 in ?? () from /usr/lib64/libQtWebKit.so.4
#3  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#4  0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7fdf35c03700 (LWP 12572)):
#0  0x00007fdf6e24d231 in ?? () from /usr/lib64/libglib-2.0.so.0
#1  0x00007fdf6e24d469 in g_mutex_lock () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fdf6e210ec9 in g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fdf6e2115ab in ?? () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fdf6e2117a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#5  0x00007fdf75645166 in QEventDispatcherGlib::processEvents (this=0x7fdf30002800, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007fdf7561597f in QEventLoop::processEvents (this=this@entry=0x7fdf35c02e00, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007fdf75615c08 in QEventLoop::exec (this=0x7fdf35c02e00, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007fdf755180e0 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#9  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x4f975c0) at thread/qthread_unix.cpp:338
#10 0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#11 0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7fdf34976700 (LWP 12902)):
#0  0x00007fdf73f258f4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fdf7551b61b in wait (time=18446744073709551615, this=0x1c56d20) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x193b380, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fdf6b30a971 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1c52cc0, th=0x7d63b90) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/WeaverImpl.cpp:365
#4  0x00007fdf6b30d1bb in ThreadWeaver::WorkingHardState::applyForWork (this=0x1855e90, th=0x7d63b90) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/WorkingHardState.cpp:71
#5  0x00007fdf6b30d1d4 in ThreadWeaver::WorkingHardState::applyForWork (this=0x1855e90, th=0x7d63b90) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/WorkingHardState.cpp:74
#6  0x00007fdf6b30c02f in ThreadWeaver::ThreadRunHelper::run (this=this@entry=0x7fdf34975e00, parent=0x1c52cc0, th=th@entry=0x7d63b90) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:87
#7  0x00007fdf6b30c0bb in ThreadWeaver::Thread::run (this=0x7d63b90) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:142
#8  0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x7d63b90) at thread/qthread_unix.cpp:338
#9  0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#10 0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fdee2f86700 (LWP 12908)):
[KCrash Handler]
#6  ref (this=0x100000008) at /usr/include/QtCore/qatomic_x86_64.h:121
#7  TypePtr (o=..., this=0x7fdee2f850b0) at /usr/include/kdevplatform/language/duchain/types/typepointer.h:75
#8  KDevelop::AbstractTypeBuilder<Php::AstNode, Php::IdentifierAst, Php::ContextBuilder>::currentAbstractType (this=0x7fdee2f85bc0) at /usr/include/kdevplatform/language/duchain/builders/abstracttypebuilder.h:174
#9  0x00007fdf44e61b2d in Php::TypeBuilder::visitConstantDeclaration (this=0x7fdee2f85bc0, node=0x7fdedd72c068) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/typebuilder.cpp:336
#10 0x00007fdf44e521b9 in Php::DeclarationBuilder::visitConstantDeclaration (this=0x7fdee2f85bc0, node=0x7fdedd72c068) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/declarationbuilder.cpp:511
#11 0x00007fdf44c0b51d in Php::DefaultVisitor::visitStatement (this=0x7fdee2f85c20, node=0x7fdedd72bf30) at /usr/src/debug/kdevelop-php-1.4.1/build/parser/phpdefaultvisitor.cpp:909
#12 0x00007fdf44e61ef0 in Php::TypeBuilder::visitStatement (this=0x7fdee2f85bc0, node=0x7fdedd72bf30) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/typebuilder.cpp:446
#13 0x00007fdf44e5567a in Php::DeclarationBuilder::visitStatement (this=0x7fdee2f85bc0, node=0x7fdedd72bf30) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/declarationbuilder.cpp:1007
#14 0x00007fdf44c0b746 in Php::DefaultVisitor::visitTopStatement (this=0x7fdee2f85c20, node=0x7fdedd72bef0) at /usr/src/debug/kdevelop-php-1.4.1/build/parser/phpdefaultvisitor.cpp:987
#15 0x00007fdf44e4f45e in Php::DeclarationBuilder::visitOuterTopStatement (this=0x7fdee2f85bc0, node=0x7fdedd72bec0) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/declarationbuilder.cpp:670
#16 0x00007fdf44c0b1fd in Php::DefaultVisitor::visitStart (this=0x7fdee2f85c20, node=<optimized out>) at /usr/src/debug/kdevelop-php-1.4.1/build/parser/phpdefaultvisitor.cpp:819
#17 0x00007fdf44e5bd16 in Php::ContextBuilder::startVisiting (this=0x7fdee2f85bc0, node=0x7fdedd7fb040) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/contextbuilder.cpp:116
#18 0x00007fdf44e562c9 in supportBuild (context=0x7fdedd7e1b30, node=0x7fdedd7fb040, this=0x7fdee2f85bc0) at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:133
#19 supportBuild (context=<optimized out>, node=0x7fdedd7fb040, this=0x7fdee2f85bc0) at /usr/include/kdevplatform/language/duchain/builders/abstracttypebuilder.h:85
#20 Php::DeclarationBuilder::supportBuild (this=0x7fdee2f85bc0, node=0x7fdedd7fb040, context=<optimized out>) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/declarationbuilder.cpp:1166
#21 0x00007fdf44e5992f in KDevelop::AbstractContextBuilder<Php::AstNode, Php::IdentifierAst>::build (this=this@entry=0x7fdee2f85bc0, url=..., node=node@entry=0x7fdedd7fb040, updateContext=...) at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:113
#22 0x00007fdf44e53a24 in Php::DeclarationBuilder::build (this=0x7fdee2f85bc0, url=..., node=0x7fdedd7fb040, updateContext=...) at /usr/src/debug/kdevelop-php-1.4.1/duchain/builders/declarationbuilder.cpp:145
#23 0x00007fdf450ead96 in Php::ParseJob::run (this=0x79a8c00) at /usr/src/debug/kdevelop-php-1.4.1/phpparsejob.cpp:152
#24 0x00007fdf6b30c82a in ThreadWeaver::JobRunHelper::runTheJob (this=this@entry=0x7fdee2f85db0, th=th@entry=0x7b04020, job=job@entry=0x79a8c00) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Job.cpp:106
#25 0x00007fdf6b30c9a1 in ThreadWeaver::Job::execute (this=0x79a8c00, th=0x7b04020) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Job.cpp:135
#26 0x00007fdf6b30bfff in ThreadWeaver::ThreadRunHelper::run (this=this@entry=0x7fdee2f85e00, parent=0x1c52cc0, th=th@entry=0x7b04020) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:95
#27 0x00007fdf6b30c0bb in ThreadWeaver::Thread::run (this=0x7b04020) at /usr/src/debug/kdelibs-4.10.1/threadweaver/Weaver/Thread.cpp:142
#28 0x00007fdf7551b0bc in QThreadPrivate::start (arg=0x7b04020) at thread/qthread_unix.cpp:338
#29 0x00007fdf73f21e0e in start_thread () from /lib64/libpthread.so.0
#30 0x00007fdf7421a2cd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fdf77a62780 (LWP 12185)):
#0  0x00007fdf7420e1ed in read () from /lib64/libc.so.6
#1  0x00007fdf6e24c82f in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fdf6e211209 in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fdf6e211622 in ?? () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fdf6e2117a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#5  0x00007fdf75645146 in QEventDispatcherGlib::processEvents (this=0x141aad0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#6  0x00007fdf74a60bee in ?? () from /usr/lib64/libQtGui.so.4
#7  0x00007fdf7561597f in QEventLoop::processEvents (this=this@entry=0x7fff3d8704d0, flags=...) at kernel/qeventloop.cpp:149
#8  0x00007fdf75615c08 in QEventLoop::exec (this=0x7fff3d8704d0, flags=...) at kernel/qeventloop.cpp:204
#9  0x00007fdf7561a8a8 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#10 0x000000000040f0aa in ?? ()
#11 0x00007fdf74157455 in __libc_start_main () from /lib64/libc.so.6
#12 0x000000000040f7f1 in _start ()

Reported using DrKonqi
Comment 1 Yusef MHG 2013-07-11 13:26:40 UTC
Same or similar bug here:

KDE Platform Version: 4.8.4 
Qt Version: 4.8.4
Operating System: 3.9-1-amd64
Distribution: Debian Jessie

-- Information about the crash:
While parsing a project kdevelop crashes. Parsing crashes only when there are some C++ STL includes.

The crash can be reproduced every time.

-- (useless) Backtrace:
Application: KDevelop (kdevelop), signal: Aborted

(Yes, the backtrace was useless even with the dbg symbols installed)
Comment 2 Milian Wolff 2013-12-01 18:55:41 UTC
Git commit 357f56d5502f0fafafed6e769f86e568cecb0bf3 by Milian Wolff.
Committed on 01/12/2013 at 16:27.
Pushed by mwolff into branch '1.6'.

Check the validity of currentAbstractType before accessing it.

Apparently there can be cases where m_gotTypeFromDocComment is true
but the type is invalid. To prevent crashes, we check this now and
fall back to the cases of m_gotTypeFromDocComment being false.

M  +1    -1    duchain/builders/typebuilder.cpp

http://commits.kde.org/kdev-php/357f56d5502f0fafafed6e769f86e568cecb0bf3