Bug 297910 - kdevelop background parser crashes on large c/c++ projects.
Summary: kdevelop background parser crashes on large c/c++ projects.
Status: RESOLVED DUPLICATE of bug 302466
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2012-04-11 16:12 UTC by Paweł Sikora
Modified: 2013-03-31 00:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
gdb backtrace. (228.86 KB, application/octet-stream)
2012-04-11 16:13 UTC, Paweł Sikora
Details
kdevelop parser crash testcase #1 (935 bytes, text/plain)
2012-06-23 18:28 UTC, Paweł Sikora
Details
parser crash #2 (21.28 KB, application/x-gzip)
2012-06-23 20:37 UTC, Paweł Sikora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paweł Sikora 2012-04-11 16:12:39 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120324 Iceweasel/11.0
Build Identifier: 

kdevelop's parser eats lot of memory (few gigabytes) and crashes on large projects.
gcc-4.7 codebase or something else that uses boost library is enough to repoduce bug.
afaics in gdb there's a problem with recursion (full gdb backtrace attached).

Reproducible: Always

Steps to Reproduce:
1. unpack gcc-4.7.0 tarball.
2. go to gcc/ subdirectory.
3. create kdevelop project (other gnu/makefiles)
4. wait few minutes for background crash.
Actual Results:  
gpf.


used software:
kde4-kdevelop-4.3.0-1.x86_64
kde4-kdevplatform-1.3.0-1.x86_64
Comment 1 Paweł Sikora 2012-04-11 16:13:18 UTC
Created attachment 70313 [details]
gdb backtrace.
Comment 2 Milian Wolff 2012-04-11 16:41:28 UTC
hm actually looks like an infinite recursion in KDevelop::DUContextDynamicData::scopeIdentifier
Comment 3 Paweł Sikora 2012-04-12 19:05:57 UTC
(In reply to comment #2)
> hm actually looks like an infinite recursion in
> KDevelop::DUContextDynamicData::scopeIdentifier

i would say "too deep". before scopeIdentifier() crash there're >50k
other stack frames and 8MB stack can't handle this. i suppose that
kdevelop's parser doesn't handle include guards and walks through
includes in madness.
Comment 4 Paweł Sikora 2012-06-23 15:10:28 UTC
kdevelop-4.3.1 still crashes on gcc sources.
Comment 5 Paweł Sikora 2012-06-23 18:28:23 UTC
Created attachment 72078 [details]
kdevelop parser crash testcase #1
Comment 6 Paweł Sikora 2012-06-23 20:37:53 UTC
Created attachment 72081 [details]
parser crash #2
Comment 7 Paweł Sikora 2012-06-23 20:38:32 UTC
backtrace for the crash #2:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f13c2d62700 (LWP 13106)]
TypePtr (p=0x2, this=0x7f13c2d5b340) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/types/typepointer.h:68
68              : d(p) { if(d) d->ref.ref(); }
(gdb) bt
#0  TypePtr (p=0x2, this=0x7f13c2d5b340) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/types/typepointer.h:68
#1  KDevelop::AbstractType::indexed (this=0x2) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/types/abstracttype.cpp:101
#2  0x00007f1444261523 in KDevelop::TopDUContext::DeclarationChecker::operator() (this=this@entry=0x7f13c2d5b4f0, decl=decl@entry=0x7f13a807a690)
    at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:520
#3  0x00007f1444267115 in KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor> (this=this@entry=0x7f13a8008650, previous=
    ..., identifier=..., accept=..., position=..., canBeNamespace=canBeNamespace@entry=false, buddy=buddy@entry=0x0, recursionDepth=recursionDepth@entry=2)
    at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:1085
#4  0x00007f144426728f in KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor> (this=this@entry=0x7f13a8008650, 
    previous=..., identifier=..., accept=..., position=..., canBeNamespace=canBeNamespace@entry=false, buddy=buddy@entry=0x0, 
    recursionDepth=recursionDepth@entry=1) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:1053
#5  0x00007f144426728f in KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor> (this=this@entry=0x7f13a8008650, 
    previous=..., identifier=..., accept=..., position=..., canBeNamespace=canBeNamespace@entry=false, buddy=buddy@entry=0x0, 
    recursionDepth=recursionDepth@entry=0) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:1053
#6  0x00007f1444267be9 in KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor> (this=this@entry=0x7f13a8008650, 
    identifiers=..., acceptor=..., position=..., canBeNamespace=canBeNamespace@entry=false)
    at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:1124
#7  0x00007f14442626b0 in KDevelop::TopDUContext::findDeclarationsInternal (this=0x7f13a8008650, identifiers=..., position=..., dataType=..., ret=..., 
    flags=...) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/topducontext.cpp:932
#8  0x00007f13c382e877 in Cpp::CppDUContext<KDevelop::TopDUContext>::findDeclarationsInternal (this=0x7f13a8008650, identifiers=..., position=..., 
    dataType=..., ret=..., source=0x7f13a8008650, basicFlags=..., depth=depth@entry=0)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/cppducontext.h:281
#9  0x00007f13c388aa1f in Cpp::FindDeclaration::closeIdentifier (this=0x7f13c2d60020, isFinalIdentifier=true)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/cppducontext.cpp:246
#10 0x00007f13c382c23e in Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal (this=this@entry=0x7f13a8046350, identifier=..., position=..., 
    dataType=..., ret=..., source=source@entry=0x7f13a8008650, basicFlags=...) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/cppducontext.h:363
#11 0x00007f13c382e054 in Cpp::CppDUContext<KDevelop::DUContext>::findDeclarationsInternal (this=0x7f13a8046350, identifiers=..., position=..., 
    dataType=..., ret=..., source=0x7f13a8008650, basicFlags=..., depth=0) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/cppducontext.h:286
#12 0x00007f144424e0ef in KDevelop::DUContext::findDeclarations (this=0x7f13a8046350, identifier=..., position=..., dataType=..., 
    topContext=<optimized out>, flags=...) at /usr/src/debug/kdevplatform-1.3.1/language/duchain/ducontext.cpp:857
#13 0x00007f13c385effd in TypeBuilder::openTypeFromName (this=this@entry=0x7f13c2d61b50, name=0x7f13a80854c8, modifiers=0, needClass=needClass@entry=false)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/typebuilder.cpp:497
#14 0x00007f13c385fe17 in visitSimpleTypeSpecifier (node=0x7f13a80854f8, this=0x7f13c2d61b50)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/typebuilder.cpp:401
#15 TypeBuilder::visitSimpleTypeSpecifier (this=0x7f13c2d61b50, node=0x7f13a80854f8)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/typebuilder.cpp:286
#16 0x00007f13c357abfe in DefaultVisitor::visitParameterDeclaration (this=0x7f13c2d61bb0, node=0x7f13a8085748)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/default_visitor.cpp:311
#17 0x00007f13c385db1f in TypeBuilder::visitParameterDeclaration (this=0x7f13c2d61b50, node=<optimized out>)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/typebuilder.cpp:822
#18 0x00007f13c383431b in DeclarationBuilder::visitParameterDeclaration (this=0x7f13c2d61b50, node=0x7f13a8085748)
---Type <return> to continue, or q <return> to quit---
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:1586
#19 0x00007f13c357b321 in visitNodes<ParameterDeclarationAST*> (nodes=<optimized out>, v=<optimized out>)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/visitor.h:139
#20 DefaultVisitor::visitParameterDeclarationClause (this=0x7f13c2d61bb0, node=<optimized out>)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/default_visitor.cpp:318
#21 0x00007f13c381fa9c in ContextBuilder::visitParameterDeclarationClause (this=0x7f13c2d61b50, node=<optimized out>)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:888
#22 0x00007f13c3822c3a in ContextBuilder::visitDeclarator (this=0x7f13c2d61b50, node=0x7f13a80852a8)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:940
#23 0x00007f13c3835c3f in DeclarationBuilder::visitDeclarator (this=0x7f13c2d61b50, node=0x7f13a80852a8)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:433
#24 0x00007f13c3832cfb in DeclarationBuilder::visitFunctionDeclaration (this=0x7f13c2d61b50, node=0x7f13a8086118)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:179
#25 0x00007f13c38231c3 in ContextBuilder::visitFunctionDefinition (this=0x7f13c2d61b50, node=0x7f13a8086118)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:576
#26 0x00007f13c357b9d1 in visitNodes<DeclarationAST*> (v=0x7f13c2d61bb0, nodes=0x2) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/visitor.h:139
#27 0x00007f13c3820524 in ContextBuilder::visitNamespace (this=0x7f13c2d61b50, node=0x7f13a80851f8)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:472
#28 0x00007f13c383391c in DeclarationBuilder::visitNamespace (this=0x7f13c2d61b50, ast=0x7f13a80851f8)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:1050
#29 0x00007f13c357b9d1 in visitNodes<DeclarationAST*> (v=0x7f13c2d61bb0, nodes=0x2) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/visitor.h:139
#30 0x00007f13c3820524 in ContextBuilder::visitNamespace (this=0x7f13c2d61b50, node=0x7f13a80851a0)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:472
#31 0x00007f13c383391c in DeclarationBuilder::visitNamespace (this=0x7f13c2d61b50, ast=0x7f13a80851a0)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:1050
#32 0x00007f13c357b9d1 in visitNodes<DeclarationAST*> (v=0x7f13c2d61bb0, nodes=0x2) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/visitor.h:139
#33 0x00007f13c3820524 in ContextBuilder::visitNamespace (this=0x7f13c2d61b50, node=0x7f13a8085148)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:472
#34 0x00007f13c383391c in DeclarationBuilder::visitNamespace (this=0x7f13c2d61b50, ast=0x7f13a8085148)
    at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:1050
#35 0x00007f13c357b9d1 in visitNodes<DeclarationAST*> (v=0x7f13c2d61bb0, nodes=0x2) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/parser/visitor.h:139
#36 0x00007f13c3825f69 in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7f13c2d61b50, node=0x7f13a8085110, context=0x7f13a8008650)
    at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:133
#37 0x00007f13c3824286 in ContextBuilder::buildContexts (this=0x7f13c2d61b50, file=..., node=0x7f13a8085110, includes=0x7f13c2d61870, updateContext=...,
    removeOldImports=false) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/contextbuilder.cpp:421
#38 0x00007f13c3830749 in DeclarationBuilder::buildDeclarations (this=0x7f13c2d61b50, file=..., node=<optimized out>, includes=<optimized out>,
    updateContext=..., removeOldImports=false) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppduchain/declarationbuilder.cpp:94
#39 0x00007f13c3d7e12c in CPPInternalParseJob::run (this=0x48c1410) at /usr/src/debug/kdevelop-4.3.1/languages/cpp/cppparsejob.cpp:637
#40 0x00007f143edb263d in ?? () from /usr/lib64/libthreadweaver.so.4
#41 0x00007f143edb27dd in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib64/libthreadweaver.so.4
---Type <return> to continue, or q <return> to quit---
#42 0x00007f143edb3f93 in ?? () from /usr/lib64/libthreadweaver.so.4
#43 0x00007f143edb1bbf in ?? () from /usr/lib64/libthreadweaver.so.4
#44 0x00007f143edb1ce6 in ThreadWeaver::Thread::run() () from /usr/lib64/libthreadweaver.so.4
#45 0x00007f144815ec9b in ?? () from /usr/lib64/libQtCore.so.4
#46 0x00007f1446b91fef in start_thread (arg=0x7f13c2d62700) at pthread_create.c:305
#47 0x00007f1446e8ecbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#48 0x0000000000000000 in ?? ()
Comment 8 Milian Wolff 2013-01-13 19:19:01 UTC
bug 302466 contains a better backtrace

*** This bug has been marked as a duplicate of bug 302466 ***
Comment 9 Aleix Pol 2013-03-31 00:55:40 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively