Bug 375037 - Style-checking hangs and uses all memory when opening __builtin__.py
Summary: Style-checking hangs and uses all memory when opening __builtin__.py
Status: RESOLVED FIXED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: Language support (show other bugs)
Version: 5.0.80
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: 5.1.0
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-14 11:50 UTC by Francis Herne
Modified: 2017-01-14 13:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francis Herne 2017-01-14 11:50:05 UTC
Using head of 5.1 (301ca47).

When opening documentation_files/__builtin__.py under the kdev-python source tree, KDevelop hangs. Memory usage rises over a few seconds and then KDevelop gets OOM-killed.

Backtrace from just before getting SIGKILLed:

Thread 1 "kdevelop" received signal SIGINT, Interrupt.
0x00007ffff10655e1 in QString::QString(int, Qt::Initialization) () from /usr/lib/libQt5Core.so.5
(gdb) bt full
#0  0x00007ffff10655e1 in QString::QString(int, Qt::Initialization) () at /usr/lib/libQt5Core.so.5
#1  0x00007ffff121705d in  () at /usr/lib/libQt5Core.so.5
#2  0x00007ffff106ae42 in QString::fromUtf8_helper(char const*, int) () at /usr/lib/libQt5Core.so.5
#3  0x00007ffff106aeb6 in QString::fromAscii_helper(char const*, int) () at /usr/lib/libQt5Core.so.5
#4  0x00007fffb1861d2f in QString::QString(QByteArray const&) (this=0x7fffffffb520, a=...) at /usr/include/qt/QtCore/qstring.h:667
#5  0x00007fffb187569d in Python::StyleChecking::processOutputStarted() (this=0x1789b10) at /home/flh/projects/kdev-python/pythonstylechecking.cpp:153
        d = {d = 0x7ffff1266040 <QArrayData::shared_null>}
        ofs = 5836
        prev = 5792
        size_d = {d = 0x3718430}
        ok = true
        size = 13193
        buf = {d = 0x1c0b6f0}
        errors = {d = 0x7fff67ffd010}
        t = <incomplete type>
#6  0x00007fffb187751a in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Python::StyleChecking::*)()>::call(void (Python::StyleChecking::*)(), Python::StyleChecking*, void**) (f=(void (Python::StyleChecking::*)(Python::StyleChecking * const)) 0x7fffb1875450 <Python::StyleChecking::processOutputStarted()>, o=0x1789b10, arg=0x7fffffffb700)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:141
#7  0x00007fffb187733c in QtPrivate::FunctionPointer<void (Python::StyleChecking::*)()>::call<QtPrivate::List<>, void>(void (Python::StyleChecking::*)(), Python::StyleChecking*, void**) (f=(void (Python::StyleChecking::*)(Python::StyleChecking * const)) 0x7fffb1875450 <Python::StyleChecking::processOutputStarted()>, o=0x1789b10, arg=0x7fffffffb700)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:160
#8  0x00007fffb18771e5 in QtPrivate::QSlotObject<void (Python::StyleChecking::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x1799df0, r=0x1789b10, a=0x7fffffffb700, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:120
#9  0x00007ffff11e65ae in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#10 0x00007ffff10f4f18 in  () at /usr/lib/libQt5Core.so.5
#11 0x00007ffff10f5370 in  () at /usr/lib/libQt5Core.so.5
#12 0x00007ffff11e6239 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff1260ace in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#14 0x00007ffff11f2ef2 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#15 0x00007ffff1e9435c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#16 0x00007ffff1e9bad1 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007ffff11baa40 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#18 0x00007ffff120f91d in  () at /usr/lib/libQt5Core.so.5
#19 0x00007fffe4da6587 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#20 0x00007fffe4da67f0 in  () at /usr/lib/libglib-2.0.so.0
#21 0x00007fffe4da689c in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#22 0x00007ffff120f46f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#23 0x00007ffff11b8e9a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff11c139c in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#25 0x000000000040f341 in main(int, char**) (argc=3, argv=0x7fffffffe148) at /home/flh/projects/kdevelop/app/main.cpp:763
        timer = {t1 = -9223372036854775808, t2 = -9223372036854775808}
        description = "The KDevelop Integrated Development Environment"
        aboutData = {d = 0x642e00}
        debugArgs =
              {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff1267e20 <QListData::shared_null>}, d = 0x7ffff1267e20 <QListData::shared_null>}}, <No data fields>}
        debugeeName = {static null = {<No data fields>}, d = 0x7ffff1266040 <QArrayData::shared_null>}
        app = {<QApplication> = {<No data fields>}, <No data fields>}
        migrator = {d = 0x6970e0}
        __PRETTY_FUNCTION__ = "int main(int, char**)"
        parser = {d = 0x63fd00}
        initialFiles = {d = 0x7ffff1266040 <QArrayData::shared_null>}
        availableSessionInfos = {d = 0x6fa5b0}
        session = {static null = {<No data fields>}, d = 0x6b8f80}
        nRunningSessions = 0
        core = 0x6ce780
        projectNames =
---Type <return> to continue, or q <return> to quit---
              {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff1267e20 <QListData::shared_null>}, d = 0x7ffff1267e20 <QListData::shared_null>}}, <No data fields>}
(gdb)
Comment 1 Sven Brauch 2017-01-14 13:10:36 UTC
Git commit 07a4f7a2df00d4d891e6683e2dbbe416f993df51 by Sven Brauch.
Committed on 14/01/2017 at 13:08.
Pushed by brauch into branch '5.1'.

style checking: read data from stdin as bytes, not in some encoding

This makes sure the correct amount of bytes is read.
Might be related to

M  +4    -4    codestyle.py

https://commits.kde.org/kdev-python/07a4f7a2df00d4d891e6683e2dbbe416f993df51
Comment 2 Sven Brauch 2017-01-14 13:10:36 UTC
Git commit 1e483026bc536321dd255ef8dc3324bb1ce39a07 by Sven Brauch.
Committed on 14/01/2017 at 13:09.
Pushed by brauch into branch '5.1'.

Fix OOM condition in style checking: move buffer processing out of read loop

Code was obviously broken, just look at it ;)

M  +8    -7    pythonstylechecking.cpp

https://commits.kde.org/kdev-python/1e483026bc536321dd255ef8dc3324bb1ce39a07