Bug 322111 - C++ background parser runs out of memory or suffers deadlock
Summary: C++ background parser runs out of memory or suffers deadlock
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-08 11:47 UTC by Vasiliy Yeremeyev
Modified: 2015-12-04 18:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
thread backtraces (18.23 KB, text/plain)
2013-07-08 11:48 UTC, Vasiliy Yeremeyev
Details
thread backtraces (31.08 KB, text/plain)
2013-12-27 13:01 UTC, Vasiliy Yeremeyev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Yeremeyev 2013-07-08 11:47:30 UTC
Kdevelop crashes with std::bad_alloc exception (SIGABRT). Background parser seems to be getting stuck somewhere - enters infinite loop.
Problem appeared near 4.5, however it could be triggered by changes in project I'm working on.
Kdevelop 4.3/4.4 didn't use too much memory with the same project.
Everything works fine if background parser is disabled.

kdevelop: 5769470 Aleix Pol Fri, 5 Jul 2013 03:22:22 +0200 Improve the Config.cmake lookup 
paths
kdevplatform: 2c6e044 Aleix Pol Fri, 5 Jul 2013 02:15:38 +0200 Enable sorting on the unit tests tree view


Reproducible: Always




#0  0x00007ffff490afb5 in raise () from /lib64/libc.so.6
#1  0x00007ffff490c438 in abort () from /lib64/libc.so.6
#2  0x00007ffff4ce0705 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/libstdc++.so.6
#3  0x00007ffff4cde806 in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/libstdc++.so.6
#4  0x00007ffff4cde833 in std::terminate() () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/libstdc++.so.6
#5  0x00007ffff4cdea5e in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/libstdc++.so.6
#6  0x00007ffff5c882a2 in qBadAlloc() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007ffff5caffe2 in QListData::realloc(int) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007ffff5cb0057 in QListData::append(int) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007fff499bae9a in append (t=@0x7fff2fbe9f40: 0x7ffecdcfb9a0, this=0x7fff2fbe9f00) at /usr/include/qt4/QtCore/qlist.h:530
#10 operator<< (t=@0x7fff2fbe9f40: 0x7ffecdcfb9a0, this=0x7fff2fbe9f00) at /usr/include/qt4/QtCore/qlist.h:334
#11 DeclarationBuilder::resolveNamespaceIdentifier (this=this@entry=0x7fff2fbea6a0, identifier=..., position=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/declarationbuilder.cpp:1284
#12 0x00007fff499bb4c0 in DeclarationBuilder::visitNamespaceAliasDefinition (this=0x7fff2fbea6a0, node=0x7ffed3334cb0) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/declarationbuilder.cpp:1396
#13 0x00007fff496ff2b9 in visitNodes<DeclarationAST*> (v=0x7fff2fbea700, nodes=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.h:139
#14 0x00007fff499a56bc in ContextBuilder::visitNamespace (this=0x7fff2fbea6a0, node=0x7ffed3334ab8) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/contextbuilder.cpp:473
#15 0x00007fff499b8534 in DeclarationBuilder::visitNamespace (this=0x7fff2fbea6a0, ast=0x7ffed3334ab8) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/declarationbuilder.cpp:1134
#16 0x00007fff496ff2b9 in visitNodes<DeclarationAST*> (v=0x7fff2fbea700, nodes=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/visitor.h:139
#17 0x00007fff499a9369 in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7fff2fbea6a0, node=0x7ffed3334a70, context=<optimized out>) at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:133
#18 0x00007fff499a892a in ContextBuilder::buildContexts (this=0x7fff2fbea6a0, file=..., node=0x7ffed3334a70, includes=<optimized out>, updateContext=..., removeOldImports=false)
    at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/contextbuilder.cpp:422
#19 0x00007fff499b40f2 in DeclarationBuilder::buildDeclarations (this=<optimized out>, file=..., node=<optimized out>, includes=<optimized out>, updateContext=..., removeOldImports=false)
    at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppduchain/declarationbuilder.cpp:96
#20 0x00007fff49ecda26 in CPPInternalParseJob::run (this=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppparsejob.cpp:644
#21 0x00007fff49ed2cbf in PreprocessJob::sourceNeeded (this=0x7ffed22a1190, _fileName=..., type=<optimized out>, sourceLine=12, skipCurrentPath=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:581
#22 0x00007fff49c873ec in rpp::pp::handle_include (this=this@entry=0x7fff2fbeaed0, skip_current_path=<optimized out>, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:219
#23 0x00007fff49c8a72f in rpp::pp::handle_directive (this=this@entry=0x7fff2fbeaed0, directive=directive@entry=95846, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:137
#24 0x00007fff49c8ad5c in rpp::pp::operator() (this=this@entry=0x7fff2fbeaed0, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:272
#25 0x00007fff49c8af90 in rpp::pp::processFileInternal (this=0x7fff2fbeaed0, fileName=..., fileContents=..., result=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:98
#26 0x00007fff49c8b306 in rpp::pp::processFile (this=<optimized out>, fileName=..., data=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:85
#27 0x00007fff49ed4bb3 in PreprocessJob::run (this=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:245
#28 0x00007fff49ecb05e in CPPParseJob::parseForeground (this=0x7ffed310ec40) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppparsejob.cpp:181
#29 0x00007fff49ed2cbf in PreprocessJob::sourceNeeded (this=0x7ffed2797570, _fileName=..., type=<optimized out>, sourceLine=14, skipCurrentPath=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:581
#30 0x00007fff49c873ec in rpp::pp::handle_include (this=this@entry=0x7fff2fbec5e0, skip_current_path=<optimized out>, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:219
#31 0x00007fff49c8a72f in rpp::pp::handle_directive (this=this@entry=0x7fff2fbec5e0, directive=directive@entry=95846, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:137
#32 0x00007fff49c8ad5c in rpp::pp::operator() (this=this@entry=0x7fff2fbec5e0, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:272
#33 0x00007fff49c8af90 in rpp::pp::processFileInternal (this=0x7fff2fbec5e0, fileName=..., fileContents=..., result=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:98
#34 0x00007fff49c8b306 in rpp::pp::processFile (this=<optimized out>, fileName=..., data=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:85
#35 0x00007fff49ed4bb3 in PreprocessJob::run (this=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:245
#36 0x00007fff49ecb05e in CPPParseJob::parseForeground (this=0x7ffed2798c20) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/cppparsejob.cpp:181
#37 0x00007fff49ed2cbf in PreprocessJob::sourceNeeded (this=0x54f7a10, _fileName=..., type=<optimized out>, sourceLine=8, skipCurrentPath=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:581
#38 0x00007fff49c873ec in rpp::pp::handle_include (this=this@entry=0x7fff2fbedcf0, skip_current_path=<optimized out>, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:219
#39 0x00007fff49c8a72f in rpp::pp::handle_directive (this=this@entry=0x7fff2fbedcf0, directive=directive@entry=95846, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:137
#40 0x00007fff49c8ad5c in rpp::pp::operator() (this=this@entry=0x7fff2fbedcf0, input=..., output=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:272
#41 0x00007fff49c8af90 in rpp::pp::processFileInternal (this=0x7fff2fbedcf0, fileName=..., fileContents=..., result=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:98
#42 0x00007fff49c8b306 in rpp::pp::processFile (this=<optimized out>, fileName=..., data=...) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/parser/rpp/pp-engine.cpp:85
#43 0x00007fff49ed4bb3 in PreprocessJob::run (this=<optimized out>) at /var/tmp/portage/dev-util/kdevelop-9999/work/kdevelop-9999/languages/cpp/preprocessjob.cpp:245
#44 0x00007fffec32c8fa in ?? () from /usr/lib64/libthreadweaver.so.4
#45 0x00007fffec32ca71 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib64/libthreadweaver.so.4
#46 0x00007fffec32da73 in ?? () from /usr/lib64/libthreadweaver.so.4
#47 0x00007fffec32c0df in ?? () from /usr/lib64/libthreadweaver.so.4
#48 0x00007fffec32c19b in ThreadWeaver::Thread::run() () from /usr/lib64/libthreadweaver.so.4
#49 0x00007ffff5c92a0c in ?? () from /usr/lib64/qt4/libQtCore.so.4
#50 0x00007ffff46bef4a in start_thread () from /lib64/libpthread.so.0
#51 0x00007ffff49bd23d in clone () from /lib64/libc.so.6
Comment 1 Vasiliy Yeremeyev 2013-07-08 11:48:54 UTC
Created attachment 81010 [details]
thread backtraces
Comment 2 Vasiliy Yeremeyev 2013-09-30 19:06:29 UTC
Looks like kdevelop hangs in KDevelop::DUContext::findDeclarations:

#15 0x00007f64ae82e02b in KDevelop::DUContext::findDeclarations (this=0x7f638fbf5b90, identifier=..., position=..., dataType=..., topContext=<optimized out>, flags=...)
    at kdevplatform/language/duchain/ducontext.cpp:848
#16 0x00007f6406dc8e5b in DeclarationBuilder::resolveNamespaceIdentifier (this=this@entry=0x7f63a7ffbd30, identifier=..., position=...) at kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:1286
#17 0x00007f6406dc96b0 in DeclarationBuilder::visitNamespaceAliasDefinition (this=0x7f63a7ffbd30, node=0x7f638f9f3bc0) at kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:1394
#18 0x00007f6406b0d2b9 in visitNodes<DeclarationAST*> (v=0x7f63a7ffbd90, nodes=<optimized out>) at kdevelop/languages/cpp/parser/visitor.h:139
#19 0x00007f6406db395c in ContextBuilder::visitNamespace (this=0x7f63a7ffbd30, node=0x7f638f9f39c8) at kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:473
#20 0x00007f6406dc6734 in DeclarationBuilder::visitNamespace (this=0x7f63a7ffbd30, ast=0x7f638f9f39c8) at kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:1132
#21 0x00007f6406b0d2b9 in visitNodes<DeclarationAST*> (v=0x7f63a7ffbd90, nodes=<optimized out>) at kdevelop/languages/cpp/parser/visitor.h:139
#22 0x00007f6406db7609 in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7f63a7ffbd30, node=0x7f638f9f3980, context=<optimized out>) at /usr/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:133
#23 0x00007f6406db6bca in ContextBuilder::buildContexts (this=0x7f63a7ffbd30, file=..., node=0x7f638f9f3980, includes=<optimized out>, updateContext=..., removeOldImports=false)
    at kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:422
#24 0x00007f6406dc23c2 in DeclarationBuilder::buildDeclarations (this=<optimized out>, file=..., node=<optimized out>, includes=<optimized out>, updateContext=..., removeOldImports=false)
    at kdevelop/languages/cpp/cppduchain/declarationbuilder.cpp:96
#25 0x00007f64072dc9d6 in CPPInternalParseJob::run (this=<optimized out>) at kdevelop/languages/cpp/cppparsejob.cpp:644

GUI thread is locked -- remains in lockForRead()-loop, so kdevelop is totally unresponsive:
#0  0x00007f64b11b1c8d in nanosleep () from /lib64/libc.so.6
#1  0x00007f64b11dc314 in usleep () from /lib64/libc.so.6
#2  0x00007f64ae85ee9b in KDevelop::DUChainLock::lockForRead (this=0x1be72e8, timeout=0) at kdevplatform/language/duchain/duchainlock.cpp:122
#3  0x00007f64ae85f21c in KDevelop::DUChainReadLocker::lock (this=0x7fff83e9edd0) at kdevplatform/language/duchain/duchainlock.cpp:246
#4  0x00007f641c86e7fb in ContextBrowserPlugin::showToolTip (this=this@entry=0x242cda0, view=view@entry=0x67a6e80, position=<incomplete type>) at kdevplatform/plugins/contextbrowser/contextbrowser.cpp:446
#5  0x00007f641c86f128 in ContextBrowserPlugin::textHintRequested (this=0x242cda0, cursor=...) at kdevplatform/plugins/contextbrowser/contextbrowser.cpp:388
#6  0x00007f641c865b10 in ContextBrowserPlugin::qt_static_metacall (_o=0x242cda0, _id=0, _a=0x0, _c=<optimized out>) at kdevplatform/plugins/contextbrowser/moc_contextbrowser.cpp:123
#7  0x00007f64b25cd628 in QMetaObject::activate (sender=0x67a6e80, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff83e9f010) at kernel/qobject.cpp:3539
#8  0x00007f6417cb7b5a in KateView::needTextHint(KTextEditor::Cursor const&, QString&) () from /usr/lib64/libkatepartinterfaces.so.4

kdevplatform: bd65a0e Heinz Wiesinger Sat, 28 Sep 2013 13:01:24 +0200 List correct repository in .reviewboardrc
kdevelop: c1bb810 l10n daemon script Fri, 27 Sep 2013 04:25:15 +0000 SVN_SILENT made messages (.desktop file)
Comment 3 Vasiliy Yeremeyev 2013-12-27 13:01:34 UTC
Created attachment 84294 [details]
thread backtraces

kdevelop hangs while parsing my project.
kdevelop: commit a1eaa06958762293feeddc89e2f75ab548d3f2aa 2013-12-10 04:03:12
kdevplatform: commit d8b5f226b20c2edfed5c0222e697ec2098ceaea5 2013-12-10 00:04:51
Comment 4 Milian Wolff 2015-12-04 18:00:19 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4. For that reason, I'll close
this bug. Please stay tuned for KDevelop 5.

If you think that this bug also affects KDevelop 5 with Clang, feel free to
reopen the report!

Sorry for the inconvenience, I hope you understand the reasoning above.

Cheers