Bug 304993 - KDevelop crashes during Python parsing
Summary: KDevelop crashes during Python parsing
Status: CLOSED FIXED
Alias: None
Product: kdev-python
Classification: Unclassified
Component: Language support (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-11 21:43 UTC by Adrián Chaves (Gallaecio)
Modified: 2012-08-15 08:44 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
DrKonqi crash file (28.20 KB, text/plain)
2012-08-13 19:24 UTC, rjwgnr27
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrián Chaves (Gallaecio) 2012-08-11 21:43:42 UTC
Application: kdevelop (4.4.60)
KDE Platform Version: 4.9.00 (Compiled from sources)
Qt Version: 4.8.2
Operating System: Linux 3.4.6-1-CHAKRA x86_64
Distribution: "Chakra Linux"

-- Information about the crash:
- What I was doing when the application crashed:

I have a Django project, I opened it with a KDevelop just built from master (the full chain to KDevelop plus the Python plugin), and before the parsing ends the application crashes.

The crash can be reproduced every time.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f8d3d2647c0 (LWP 23538))]

Thread 10 (Thread 0x7f8d11943700 (LWP 23548)):
#0  0x00007f8d39a72263 in select () from /lib/libc.so.6
#1  0x00007f8d3ae03c34 in ?? () from /usr/lib/libQtCore.so.4
#2  0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#4  0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#5  0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 9 (Thread 0x7f8d0a405700 (LWP 23550)):
#0  0x00007f8d39a700bf in poll () from /lib/libc.so.6
#1  0x00007f8d33c498b6 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f8d33c499e4 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f8d3ae53ed6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f8d3ae24b1f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f8d3ae24da8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f8d3ad28530 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#9  0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#10 0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 8 (Thread 0x7f8d09c04700 (LWP 23551)):
#0  0x00007f8d39782aa4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f8d36466717 in ?? () from /usr/lib/libQtScript.so.4
#2  0x00007f8d36466749 in ?? () from /usr/lib/libQtScript.so.4
#3  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#4  0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#5  0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 7 (Thread 0x7f8d08f32700 (LWP 23559)):
#0  0x00007f8d39a700bf in poll () from /lib/libc.so.6
#1  0x00007f8d33c498b6 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f8d33c499e4 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f8d3ae53ed6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f8d3ae24b1f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f8d3ae24da8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f8d3ad28530 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f8d3ae056ef in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#10 0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#11 0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 6 (Thread 0x7f8d03060700 (LWP 23594)):
#0  0x00007f8d39782aa4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f8d30dbed1c in ?? () from /usr/lib/libQtWebKit.so.4
#2  0x00007f8d30dbee49 in ?? () from /usr/lib/libQtWebKit.so.4
#3  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#4  0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#5  0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 5 (Thread 0x7f8d0285f700 (LWP 23595)):
#0  0x00007fff639ff827 in clock_gettime ()
#1  0x00007f8d38499f6d in clock_gettime () from /lib/librt.so.1
#2  0x00007f8d3ad80dc4 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f8d3ae546fd in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f8d3ae54a43 in ?? () from /usr/lib/libQtCore.so.4
#5  0x00007f8d3ae535bc in ?? () from /usr/lib/libQtCore.so.4
#6  0x00007f8d33c48fde in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#7  0x00007f8d33c497db in ?? () from /usr/lib/libglib-2.0.so.0
#8  0x00007f8d33c499e4 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#9  0x00007f8d3ae53ef6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#10 0x00007f8d3ae24b1f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#11 0x00007f8d3ae24da8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#12 0x00007f8d3ad28530 in QThread::exec() () from /usr/lib/libQtCore.so.4
#13 0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#14 0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#15 0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#16 0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 4 (Thread 0x7f8d00d33700 (LWP 23598)):
#0  0x00007f8d39782aa4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f8d3ad2b97b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f8d317c6a61 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f8d317c92ab in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f8d317c811f in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f8d317c81ab in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#6  0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#8  0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#9  0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 3 (Thread 0x7f8cf7fff700 (LWP 23683)):
[KCrash Handler]
#5  0x00007f8d0a436429 in Python::IndexedContainer::toString() const () from /usr/lib/libkdev4pythonduchain.so
#6  0x00007f8d0a430c89 in Python::VariableLengthContainer::addContentType(TypePtr<KDevelop::AbstractType>) () from /usr/lib/libkdev4pythonduchain.so
#7  0x00007f8d0a43a8ab in Python::ExpressionVisitor::visitListComprehension(Python::ListComprehensionAst*) () from /usr/lib/libkdev4pythonduchain.so
#8  0x00007f8d0a43c3bd in Python::ExpressionVisitor::visitCall(Python::CallAst*) () from /usr/lib/libkdev4pythonduchain.so
#9  0x00007f8d0a459799 in Python::DeclarationBuilder::visitCall(Python::CallAst*) () from /usr/lib/libkdev4pythonduchain.so
#10 0x00007f8d1e1214de in Python::AstDefaultVisitor::visitAssignment(Python::AssignmentAst*) () from /usr/lib/libkdev4pythonparser.so
#11 0x00007f8d0a456a77 in Python::DeclarationBuilder::visitAssignment(Python::AssignmentAst*) () from /usr/lib/libkdev4pythonduchain.so
#12 0x00007f8d0a44c117 in Python::ContextBuilder::visitFunctionBody(Python::FunctionDefinitionAst*) () from /usr/lib/libkdev4pythonduchain.so
#13 0x00007f8d0a451e64 in Python::DeclarationBuilder::visitFunctionDefinition(Python::FunctionDefinitionAst*) () from /usr/lib/libkdev4pythonduchain.so
#14 0x00007f8d1e120e63 in Python::AstDefaultVisitor::visitClassDefinition(Python::ClassDefinitionAst*) () from /usr/lib/libkdev4pythonparser.so
#15 0x00007f8d0a4512e7 in Python::DeclarationBuilder::visitClassDefinition(Python::ClassDefinitionAst*) () from /usr/lib/libkdev4pythonduchain.so
#16 0x00007f8d1e120753 in Python::AstDefaultVisitor::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonparser.so
#17 0x00007f8d0a44a097 in Python::ContextBuilder::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonduchain.so
#18 0x00007f8d0a450901 in Python::DeclarationBuilder::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonduchain.so
#19 0x00007f8d0a45ecd5 in ?? () from /usr/lib/libkdev4pythonduchain.so
#20 0x00007f8d0a44cbff in Python::ContextBuilder::build(KDevelop::IndexedString const&, Python::Ast*, KDevelop::ReferencedTopDUContext) () from /usr/lib/libkdev4pythonduchain.so
#21 0x00007f8d0a44fa43 in Python::DeclarationBuilder::build(KDevelop::IndexedString const&, Python::Ast*, KDevelop::ReferencedTopDUContext) () from /usr/lib/libkdev4pythonduchain.so
#22 0x00007f8d0a44f9ca in Python::DeclarationBuilder::build(KDevelop::IndexedString const&, Python::Ast*, KDevelop::ReferencedTopDUContext) () from /usr/lib/libkdev4pythonduchain.so
#23 0x00007f8d0a8e8699 in ?? () from /usr/lib/kde4/kdevpythonlanguagesupport.so
#24 0x00007f8d317c891a in ?? () from /usr/lib/libthreadweaver.so.4
#25 0x00007f8d317c8a91 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#26 0x00007f8d317c80ef in ?? () from /usr/lib/libthreadweaver.so.4
#27 0x00007f8d317c81ab in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#28 0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#29 0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#30 0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#31 0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 2 (Thread 0x7f8cf77fe700 (LWP 23684)):
#0  0x00007f8d39a49b5d in nanosleep () from /lib/libc.so.6
#1  0x00007f8d39a729f4 in usleep () from /lib/libc.so.6
#2  0x00007f8d3712deb2 in KDevelop::DUChainLock::lockForWrite(unsigned int) () from /usr/lib/libkdevplatformlanguage.so.7
#3  0x00007f8d3712e044 in KDevelop::DUChainWriteLocker::lock() () from /usr/lib/libkdevplatformlanguage.so.7
#4  0x00007f8d0a4544fe in Python::DeclarationBuilder::createModuleImportDeclaration(QString, QString, Python::Identifier*, Python::Ast*, Python::DeclarationBuilder::ProblemPolicy) () from /usr/lib/libkdev4pythonduchain.so
#5  0x00007f8d0a45575f in Python::DeclarationBuilder::visitImportFrom(Python::ImportFromAst*) () from /usr/lib/libkdev4pythonduchain.so
#6  0x00007f8d1e120753 in Python::AstDefaultVisitor::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonparser.so
#7  0x00007f8d0a44a097 in Python::ContextBuilder::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonduchain.so
#8  0x00007f8d0a450901 in Python::DeclarationBuilder::visitCode(Python::CodeAst*) () from /usr/lib/libkdev4pythonduchain.so
#9  0x00007f8d0a45ecd5 in ?? () from /usr/lib/libkdev4pythonduchain.so
#10 0x00007f8d0a44cbff in Python::ContextBuilder::build(KDevelop::IndexedString const&, Python::Ast*, KDevelop::ReferencedTopDUContext) () from /usr/lib/libkdev4pythonduchain.so
#11 0x00007f8d0a44fa43 in Python::DeclarationBuilder::build(KDevelop::IndexedString const&, Python::Ast*, KDevelop::ReferencedTopDUContext) () from /usr/lib/libkdev4pythonduchain.so
#12 0x00007f8d0a8e8699 in ?? () from /usr/lib/kde4/kdevpythonlanguagesupport.so
#13 0x00007f8d317c891a in ?? () from /usr/lib/libthreadweaver.so.4
#14 0x00007f8d317c8a91 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#15 0x00007f8d317c80ef in ?? () from /usr/lib/libthreadweaver.so.4
#16 0x00007f8d317c81ab in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#17 0x00007f8d3ad2b47b in ?? () from /usr/lib/libQtCore.so.4
#18 0x00007f8d2c3906d4 in ?? () from /usr/lib/libGL.so.1
#19 0x00007f8d3977eede in start_thread () from /lib/libpthread.so.0
#20 0x00007f8d39a7860d in clone () from /lib/libc.so.6

Thread 1 (Thread 0x7f8d3d2647c0 (LWP 23538)):
#0  0x00007f8d39782aa4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f8d3ad2b97b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f8d3ad2b08c in QThread::wait(unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x00007f8d3ae037f2 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f8d399cb7c1 in ?? () from /lib/libc.so.6
#5  0x00007f8d399cb845 in exit () from /lib/libc.so.6
#6  0x00007f8d3a2683b8 in ?? () from /usr/lib/libQtGui.so.4
#7  0x00007f8d3b63d498 in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib/libkdeui.so.5
#8  0x00007f8d3534717e in _XIOError () from /usr/lib/libX11.so.6
#9  0x00007f8d353449fd in _XEventsQueued () from /usr/lib/libX11.so.6
#10 0x00007f8d3533537f in XEventsQueued () from /usr/lib/libX11.so.6
#11 0x00007f8d3a29e4cc in ?? () from /usr/lib/libQtGui.so.4
#12 0x00007f8d33c492f3 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#13 0x00007f8d33c49856 in ?? () from /usr/lib/libglib-2.0.so.0
#14 0x00007f8d33c499e4 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#15 0x00007f8d3ae53ed6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#16 0x00007f8d3a29e66e in ?? () from /usr/lib/libQtGui.so.4
#17 0x00007f8d3ae24b1f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#18 0x00007f8d3ae24da8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#19 0x00007f8d3ae29a48 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#20 0x000000000040e492 in ?? ()
#21 0x00007f8d399b5455 in __libc_start_main () from /lib/libc.so.6
#22 0x000000000040ebe1 in _start ()

Reported using DrKonqi
Comment 1 rjwgnr27 2012-08-13 19:24:13 UTC
Created attachment 73144 [details]
DrKonqi crash file

Saved from DrKonqi following crash.
Comment 2 Sven Brauch 2012-08-14 10:55:28 UTC
Hi there,

does the project happen to be public? For finding the bug, it would be useful to have a file which reproduces it.

Greetings,
Sven
Comment 3 Adrián Chaves (Gallaecio) 2012-08-14 17:40:31 UTC
Mine was not public yet, but hey, this is the perfect excuse :)

https://gitorious.org/chakra-network/chakra-network-django/trees/master

The issue happens when opening a KDevelop project at the root (the folder where code, files and templates are).
Comment 4 Sven Brauch 2012-08-14 18:03:01 UTC
Git commit 1fed938f585e7f4de0f7ccace62dfedf53683cb1 by Sven Brauch.
Committed on 14/08/2012 at 19:58.
Pushed by brauch into branch 'master'.

Fix negative tuple indices from crashing the parser.

M  +4    -1    duchain/expressionvisitor.cpp
M  +1    -0    duchain/tests/pyduchaintest.cpp

http://commits.kde.org/kdev-python/1fed938f585e7f4de0f7ccace62dfedf53683cb1
Comment 5 Sven Brauch 2012-08-14 18:05:41 UTC
Haha, nice find: a newly introduced feature guessing the type of d in 
t = (1, 2, 3); d = t[2]
Smart as I am, I only checked that the index used for accessing the slice is smaller than the numer of entries in the slice -- not that it is positive. This should be fixed now.

By the way: If you build with -DCMAKE_BUILD_TYPE=debug, this would have triggered an assertion, which would have made it fixable from the backtrace. :)

Thanks for reporting, hope it works now. Please set the status to Closed - Fixed if the fix works for you.
Comment 6 Adrián Chaves (Gallaecio) 2012-08-14 19:02:00 UTC
Probably not because of the same, but I am still getting a crash (further in the parsing process): http://paste.kde.org/534464/
Comment 7 Sven Brauch 2012-08-14 19:08:25 UTC
Hmm, I cannot reproduce that crash...
Maybe the cache is corrupted? Try closing kdevelop, then rm -Rf ~/.kdevduchain (that deletes kdevelop's persistent cache directory), and retry.
Comment 8 Adrián Chaves (Gallaecio) 2012-08-14 20:05:01 UTC
Actually, when I run it after removing that folder, Dr. Konqui gets just a segmentation fault. The terminal output goes like this: http://paste.kde.org/534506/

The backtrace only appears when I run KDevelop again after that. Might there by another configuration file or folder getting in the way?
Comment 9 Sven Brauch 2012-08-14 20:13:44 UTC
Can you run kdevelop with "gdb kdevelop", then "thread apply all bt" when it crashes? Then you'll get a backtrace even if drkonqui doesn't work as intended.
Comment 10 Adrián Chaves (Gallaecio) 2012-08-14 21:07:43 UTC
http://paste.kde.org/534584/
Comment 11 Sven Brauch 2012-08-14 21:32:04 UTC
phew... I'm sorry, I don't see the problem from code+backtrace, and I can't reproduce it either.
Can you disable debug output for kdev-python in the "kdebugdialog" program? Then, it'll be easily visible from the remaining output which file is being parsed when the crash happens...
Comment 12 Adrián Chaves (Gallaecio) 2012-08-15 05:45:04 UTC
Ok, so I disabled the KDevelop Python support debug output… And no crash. Which is great because I will be able to use KDevelop again, I guess.

But getting back the Python support debug output, I pasted output enough to see the problematic file: http://paste.kde.org/534686/

It turns out it is not one of the project’s, but one of Django’s. I have the latest version installed (1.4.1), and the file where the crash happens is “/usr/lib/python2.7/site-packages/django/db/models/deletion.py”.
Comment 13 Sven Brauch 2012-08-15 08:10:11 UTC
Ah, now I can reproduce it, it crashes in doing debug output. I had it disabled, thus it worked for me. I'll try to fix it.
Comment 14 Sven Brauch 2012-08-15 08:31:00 UTC
Git commit 43753aac0da0210dc7fcc103a3dca054e2271f8b by Sven Brauch.
Committed on 15/08/2012 at 10:27.
Pushed by brauch into branch 'master'.

Don't add invalid or null types to tuples, but use mixed instead.

This should finally fix

M  +6    -1    duchain/expressionvisitor.cpp

http://commits.kde.org/kdev-python/43753aac0da0210dc7fcc103a3dca054e2271f8b
Comment 15 Sven Brauch 2012-08-15 08:31:20 UTC
Next try -- I hope it works now!
Comment 16 Adrián Chaves (Gallaecio) 2012-08-15 08:44:04 UTC
Just perfect, thanks a lot!