Summary: | kdevelop-python crash while parsing projects | ||
---|---|---|---|
Product: | [Developer tools] kdev-python | Reporter: | Christoph Haag <haagch.christoph> |
Component: | Language support | Assignee: | Francis Herne <mail> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | bladud, frmdstryr, jan, kleagg, mail, mail, soos.mate |
Priority: | NOR | Keywords: | drkonqi |
Version: | 5.6.0 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/kdevelop/kdev-python/commit/172dc5138acf94d54215d630c2173d7f24ec97df | Version Fixed In: | 5.6.1 |
Sentry Crash Report: |
Description
Christoph Haag
2020-09-07 22:19:02 UTC
Hi, thank you for the report! Does your project happen to be open-source? That would help a lot in reproducing the issue. I'm pretty sure it crashes while parsing system wide installed site packages. I figured out how to make a backtrace with system wide pretty printers installed filename=file:///usr/lib/python3.8/site-packages/networkx/drawing/layout.py which is from the archlinux python-networkx 2.5-1 package. Should be this one https://github.com/networkx/networkx/blob/networkx-2.5/networkx/drawing/layout.py #0 0x00007fff02e6fd13 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffed6ffbc40, node=0x1eb5ffffffff0ce5) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:164 #1 0x00007fff02e70249 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b5e00) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:323 #2 0x00007fff02e72c1b in Python::PythonAstTransformer::visitNodeList<_expr, Python::ExpressionAst>(asdl_seq*) (node=0x7ffec85b5d60, this=0x7ffed6ffbc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #3 Python::PythonAstTransformer::visitNode(_slice*) (this=this@entry=0x7ffed6ffbc40, node=<optimized out>) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:513 #4 0x00007fff02e70673 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b5e60) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:354 #5 0x00007fff02e70c28 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b5ff0) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:186 #6 0x00007fff02e73bec in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b6020) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:729 #7 0x00007fff02e7539b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (this=0x7ffed6ffbc40, node=0x7ffec85b5c88) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #8 0x00007fff02e73816 in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b7628) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:673 #9 0x00007fff02e7539b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (this=0x7ffed6ffbc40, node=0x7ffec85b4020) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #10 0x00007fff02e74c6e in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffed6ffbc40, node=0x7ffec85b76e8) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:580 #11 0x00007fff02e6c78b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (node=0x7ffec85709a0, this=0x7ffed6ffbc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #12 Python::PythonAstTransformer::run(_mod*, QString) (moduleName="layout", syntaxtree=<optimized out>, this=0x7ffed6ffbc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:16 #13 Python::AstBuilder::parse(QUrl const&, QString&) (this=this@entry=0x7ffed6ffbcf8, filename=file:///usr/lib/python3.8/site-packages/networkx/drawing/layout.py, contents="\"\"\"\n******\nLayout\n******\n\nNode positioning algorithms for graph drawing.\n\nFor `random_layout()` the possible resulting shape\nis a square of side [0, scale] (default: [0, 1])\nChanging `center` shifts t"...) at /usr/src/debug/kdev-python-5.6.0/parser/astbuilder.cpp:275 #14 0x00007fff02e67090 in Python::ParseSession::parse() (this=0x7ffec86da290) at /usr/src/debug/kdev-python-5.6.0/parser/parsesession.cpp:76 #15 0x00007ffed41e1fdc in Python::ParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) (this=<optimized out>) at /usr/include/qt/QtCore/qshareddata.h:160 #16 0x00007ffff2d1513c in ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #17 0x00007ffff2d15749 in ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #18 0x00007ffff2d14752 in ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #19 0x00007ffff2d13fe1 in ThreadWeaver::Thread::run() () at /usr/lib/libKF5ThreadWeaver.so.5 #20 0x00007ffff6432e0f in () at /usr/lib/libQt5Core.so.5 #21 0x00007ffff379f3e9 in start_thread () at /usr/lib/libpthread.so.0 #22 0x00007ffff60be293 in clone () at /usr/lib/libc.so.6 As a testcase I can confirm that git cloning networkx master and opening it as a custom build system project crashes kdevelop, here in a different file flow_matrix.py, but it is from inside the project and not a system wide install Thread 79 "Queue(0x5555564" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffe8f7fe640 (LWP 1308853)] 0x00007fff09055d13 in Python::PythonAstTransformer::visitNode (this=this@entry=0x7ffe8f7fcc40, node=0x3875130cd522fe27) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:164 164 /usr/src/debug/kdev-python-5.6.0/parser/generated.h: Datei oder Verzeichnis nicht gefunden. (gdb) bt #0 0x00007fff09055d13 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffe8f7fcc40, node=0x3875130cd522fe27) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:164 #1 0x00007fff09056249 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffe8f7fcc40, node=0x7ffe8005fde8) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:323 #2 0x00007fff09058c1b in Python::PythonAstTransformer::visitNodeList<_expr, Python::ExpressionAst>(asdl_seq*) (node=0x7ffe8005fd10, this=0x7ffe8f7fcc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #3 Python::PythonAstTransformer::visitNode(_slice*) (this=this@entry=0x7ffe8f7fcc40, node=<optimized out>) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:513 #4 0x00007fff09056673 in Python::PythonAstTransformer::visitNode(_expr*) (this=this@entry=0x7ffe8f7fcc40, node=0x7ffe8005fe78) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:354 #5 0x00007fff09057aeb in Python::PythonAstTransformer::visitNodeList<_expr, Python::ExpressionAst>(asdl_seq*) (this=0x7ffe8f7fcc40, node=0x7ffe8005fca0) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #6 0x00007fff09059b60 in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffe8f7fcc40, node=0x7ffe8005ff88) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:636 #7 0x00007fff0905b39b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (this=0x7ffe8f7fcc40, node=0x7ffe8005fc88) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #8 0x00007fff0905ac6e in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffe8f7fcc40, node=0x7ffe80060188) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:580 #9 0x00007fff0905b39b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (this=0x7ffe8f7fcc40, node=0x7ffe80059a78) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #10 0x00007fff09059f1e in Python::PythonAstTransformer::visitNode(_stmt*) (this=this@entry=0x7ffe8f7fcc40, node=0x7ffe80060ee8) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:617 #11 0x00007fff0905278b in Python::PythonAstTransformer::visitNodeList<_stmt, Python::Ast>(asdl_seq*) (node=0x7ffe80057e10, this=0x7ffe8f7fcc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:38 #12 Python::PythonAstTransformer::run(_mod*, QString) (moduleName="flow_matrix", syntaxtree=<optimized out>, this=0x7ffe8f7fcc40) at /usr/src/debug/kdev-python-5.6.0/parser/generated.h:16 #13 Python::AstBuilder::parse(QUrl const&, QString&) (this=this@entry=0x7ffe8f7fccf8, filename=file:///home/haagch-collabora/networkx/networkx/algorithms/centrality/flow_matrix.py, contents="# Helpers for current-flow betweenness and current-flow closness\n# Lazy computations for inverse Laplacian and flow-matrix rows.\nimport networkx as nx\n\n\ndef flow_matrix_row(G, weight=None, dtype=float"...) at /usr/src/debug/kdev-python-5.6.0/parser/astbuilder.cpp:275 #14 0x00007fff0904d090 in Python::ParseSession::parse() (this=0x7ffe80089360) at /usr/src/debug/kdev-python-5.6.0/parser/parsesession.cpp:76 #15 0x00007ffef83abfdc in Python::ParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) (this=<optimized out>) at /usr/include/qt/QtCore/qshareddata.h:160 #16 0x00007ffff2d1513c in ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #17 0x00007ffff2d15749 in ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #18 0x00007ffff2d14752 in ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&, ThreadWeaver::Thread*) () at /usr/lib/libKF5ThreadWeaver.so.5 #19 0x00007ffff2d13fe1 in ThreadWeaver::Thread::run() () at /usr/lib/libKF5ThreadWeaver.so.5 #20 0x00007ffff6432e0f in () at /usr/lib/libQt5Core.so.5 #21 0x00007ffff379f3e9 in start_thread () at /usr/lib/libpthread.so.0 #22 0x00007ffff60be293 in clone () at /usr/lib/libc.so.6 I'm investigating this. It's almost certainly a result of my Python 3.9 changes, and occurs only with previous versions.
I thought I'd tested this pretty thoroughly on 3.4 and 3.8, but clearly not enough...
It's triggered by a slice appearing as part of a multi-dimensional subscript, e.g.
> M[1:3, 3]
*** Bug 426561 has been marked as a duplicate of this bug. *** I see the same problem with the binary packages in Arch Linux extra. In case it helps, I also get this crash with the project here: https://github.com/MP-Gadget/MP-Gadget and python 3.8 I think the problem is that the assumption that the dims of an ExtSlice are Expressions is wrong. They can also be Slices, which are not Expressions. Git commit 7db8f71c9fd9c5c2ffc32638b91ba22916b6f69d by Sven Brauch. Committed on 19/09/2020 at 09:24. Pushed by brauch into branch 'fix-slice-crash'. fix crash with Extended Slices in Python 3.8 In an expression like A[1:3,5], the dims of the slice are "1:3" and "5". These are, against our assumptions, not Expressions, they are Slices: "1:3" is not an Expression (it is not valid outside a slice). So, we cannot represent this kind of slice with a tuple, it needs a separate AST node kind. M +1 -0 duchain/tests/pyduchaintest.cpp M +5 -0 parser/ast.cpp M +7 -0 parser/ast.h M +5 -0 parser/astdefaultvisitor.cpp M +1 -0 parser/astdefaultvisitor.h M +1 -0 parser/astvisitor.cpp M +1 -0 parser/astvisitor.h M +2 -2 parser/generated.h M +1 -1 parser/python39.sdef https://invent.kde.org/kdevelop/kdev-python/commit/7db8f71c9fd9c5c2ffc32638b91ba22916b6f69d Git commit 44b8992325bbcbfa350b163bf0176aad2c9d47da by Francis Herne. Committed on 19/09/2020 at 23:46. Pushed by flherne into branch 'flh-slice-crash'. Fix ExtSlice crash with Python <= 3.8 FIXED-IN: 5.6.1 The dimensions of an ExtSlice node are _slice nodes rather than _expr, so this would crash whenever encountering one. -- This was introduced in commit 05e95cac7 "Initial support for CPython 3.9". When I replaced `ExtendedSliceAst` with `TupleAst` in python39.sdef in that commit, conversionGenerator.py *also* changed `_slice` to `_expr` here (because the type used is implicitly determined in a stupid way) and I failed to notice that difference in the newly-generated code. I couldn't see an easy way to fix the implicit type thing, so this commit just bypasses that mechanism and uses CODE instead. M +1 -0 duchain/tests/pyduchaintest.cpp M +1 -1 parser/generated.h M +2 -1 parser/python39.sdef https://invent.kde.org/kdevelop/kdev-python/commit/44b8992325bbcbfa350b163bf0176aad2c9d47da Sorry, we screwed this up for 5.6.0. If you are affected by this bug, you have several options until 5.6.1 is released: - Use the KDevelop 5.5.2 AppImage from https://download.kde.org/stable/kdevelop/5.5.2/bin/linux/ (the 5.6.0 AppImage is unfortunately affected as well) - Use a version of KDevelop 5.6.0 built against Python >= 3.9.0 - As soon as the fix is merged (in a few days) build the "5.6" branch of kdev-python instead of the 5.6.0 tag. Git commit f33012fe664e77bb5621ec5a2faf69c44b8c9983 by Sven Brauch. Committed on 20/09/2020 at 12:27. Pushed by brauch into branch '5.6'. AST test: make sure we have 100% code coverage for visitors and builder M +20 -0 parser/tests/pyasttest.cpp https://invent.kde.org/kdevelop/kdev-python/commit/f33012fe664e77bb5621ec5a2faf69c44b8c9983 Git commit 172dc5138acf94d54215d630c2173d7f24ec97df by Francis Herne. Committed on 20/09/2020 at 13:42. Pushed by flherne into branch '5.6'. Fix ExtSlice crash with Python <= 3.8 FIXED-IN: 5.6.1 The dimensions of an ExtSlice node are _slice nodes rather than _expr, so this would crash whenever encountering one. -- This was introduced in commit 05e95cac7 "Initial support for CPython 3.9". When I replaced `SliceAst` with `ExpressionAst` in the relevant line of python39.sdef, conversionGenerator.py *also* changed `_slice` to `_expr` here (because the type used is implicitly determined in a stupid way) and I failed to notice that difference in the newly-generated code. I couldn't see an easy way to fix the implicit type thing, so this commit just bypasses that mechanism and uses CODE instead. M +1 -0 duchain/tests/pyduchaintest.cpp M +1 -1 parser/generated.h M +2 -1 parser/python39.sdef https://invent.kde.org/kdevelop/kdev-python/commit/172dc5138acf94d54215d630c2173d7f24ec97df *** Bug 426878 has been marked as a duplicate of this bug. *** *** Bug 427227 has been marked as a duplicate of this bug. *** |