Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-20422

Constantly repaints, uses 100% CPU

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt Creator 4.7.0-beta1
    • Qt Creator 4.5.2
    • Editors
    • None
    • Qt Creator 4.5.2
      Ubuntu 18.04 x86_64
    • 3e618cbf76f1477f85ea6966e349c9acb924c9b6

    Description

      Under very specific conditions, Qt Creator appears to get into a busy loop repainting its window and consumes 100% of one CPU core.  Xorg CPU usage also spikes.

      Conditions to reproduce:

      1. Enable the Clang Code Model
      2. Open a C++ file which contains warnings/errors
      3. Display the Search Results pane at the bottom of the window
      4. Resize the Search Results pane so that it partially covers an error annotation in the editor (i.e. so that the last, partially visible line in the editor is one that contains an error).

      See screenshots to illustrate what I mean.

      • cpu-high-{1,2}.png: These illustrate a scenario to reproduce the issue.
      • cpu-low-{1,2}.png: These illustrate a scenario which does not reproduce the issue.

      Partial oprofile report:

      samples  %        image name               symbol name
      98979     6.9345  libharfbuzz.so.0.10702.0 hb_ot_map_t::substitute(hb_ot_shape_plan_t const*, hb_font_t*, hb_buffer_t*) const
      71973     5.0424  libharfbuzz.so.0.10702.0 void hb_ot_map_t::apply<GPOSProxy>(GPOSProxy const&, hb_ot_shape_plan_t const*, hb_font_t*, hb_buffer_t*) const
      51380     3.5997  libQt5Gui.so.5.9.5       qt_alphargbblit_argb32(QRasterBuffer*, int, int, QRgba64 const&, unsigned int const*, int, int, int, QClipData const*, bool)
      29928     2.0968  libQt5Gui.so.5.9.5       qt_memfill32(unsigned int*, unsigned int, int)
      28540     1.9995  libQt5Gui.so.5.9.5       QFontEngine::subPixelPositionForX(QFixed) const
      27871     1.9526  libQt5Gui.so.5.9.5       QSharedDataPointer<QTextFormatPrivate>::~QSharedDataPointer()
      26967     1.8893  libQt5Gui.so.5.9.5       qt_fetch_linear_gradient(unsigned int*, Operator const*, QSpanData const*, int, int, int)
      25503     1.7867  libQt5Gui.so.5.9.5       comp_func_SourceOver_avx2(unsigned int*, unsigned int const*, int, unsigned int)
      24855     1.7413  libQt5XcbQpa.so.5.9.5    QHash<QFontEngineFT::GlyphAndSubPixelPosition, QFontEngineFT::Glyph*>::findNode(QFontEngineFT::GlyphAndSubPixelPosition const&, unsigned int) const
      22665     1.5879  libQt5Gui.so.5.9.5       QTextFormat::QTextFormat(QTextFormat const&)
      

      Sample backtrace of stopped Qt Creator process:

      #0  0x00007f4fb4d5152f in QTextEngine::shapeText(int) const (this=this@entry=0x55a0808c4eb0, item=item@entry=0) at text/qtextengine.cpp:1126
      #1  0x00007f4fb4d5239f in QTextEngine::shape(int) const (this=this@entry=0x55a0808c4eb0, item=item@entry=0) at text/qtextengine.cpp:1566
      #2  0x00007f4fb4d59760 in QTextEngine::shapeLine(QScriptLine const&) (this=0x55a0808c4eb0, line=...) at text/qtextengine.cpp:944
      #3  0x00007f4fb4d5b0e9 in QTextLineItemIterator::QTextLineItemIterator(QTextEngine*, int, QPointF const&, QTextLayout::FormatRange const*) (this=0x7ffe2716a490, _eng=<optimized out>, _lineNum=<optimized out>, pos=..., _selection=<optimized out>) at text/qtextengine.cpp:3614
      #4  0x00007f4fb4d6196d in QTextLine::draw(QPainter*, QPointF const&, QTextLayout::FormatRange const*) const (this=this@entry=0x7ffe2716aac0, p=p@entry=0x7ffe2716b180, pos=..., selection=selection@entry=0x0) at text/qtextlayout.cpp:2464
      #5  0x00007f4fb4d62b05 in QTextLayout::draw(QPainter*, QPointF const&, QVector<QTextLayout::FormatRange> const&, QRectF const&) const (this=0x55a0808c4e90, p=p@entry=0x7ffe2716b180, pos=..., selections=..., clip=...) at text/qtextlayout.cpp:1257
      #6  0x00007f4f93348ee9 in TextEditor::TextEditorWidget::paintBlock(QPainter*, QTextBlock const&, QPointF const&, QVector<QTextLayout::FormatRange> const&, QRect const&) const (this=<optimized out>, painter=0x7ffe2716b180, block=..., offset=..., selections=..., clipRect=...) at ./src/plugins/texteditor/texteditor.cpp:4639
      #7  0x00007f4f9335e0da in TextEditor::TextEditorWidget::paintEvent(QPaintEvent*) (this=0x55a0809953a0, e=0x7ffe2716ba60) at ./src/plugins/texteditor/texteditor.cpp:4412
      #8  0x00007f4fb5469038 in QWidget::event(QEvent*) (this=this@entry=0x55a0809953a0, event=event@entry=0x7ffe2716ba60) at kernel/qwidget.cpp:9280
      #9  0x00007f4fb550a4be in QFrame::event(QEvent*) (this=0x55a0809953a0, e=0x7ffe2716ba60) at widgets/qframe.cpp:550
      #10 0x00007f4f933667e4 in TextEditor::TextEditorWidget::viewportEvent(QEvent*) (this=0x55a0809953a0, event=0x7ffe2716ba60) at ./src/plugins/texteditor/texteditor.cpp:3401
      #11 0x00007f4fb432068c in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (receiver=receiver@entry=0x55a080995430, event=event@entry=0x7ffe2716ba60) at kernel/qcoreapplication.cpp:1135
      #12 0x00007f4fb542a805 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x55a07e311d20, receiver=receiver@entry=0x55a080995430, e=e@entry=0x7ffe2716ba60) at kernel/qapplication.cpp:3718
      #13 0x00007f4fb54320f4 in QApplication::notify(QObject*, QEvent*) (this=0x7ffe2716c7d0, receiver=0x55a080995430, e=0x7ffe2716ba60) at kernel/qapplication.cpp:3481
      #14 0x00007f4fb43209a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=receiver@entry=0x55a080995430, event=event@entry=0x7ffe2716ba60) at kernel/qcoreapplication.cpp:1024
      #15 0x00007f4fb546218a in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) (event=0x7ffe2716ba60, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
      #16 0x00007f4fb546218a in QWidgetPrivate::sendPaintEvent(QRegion const&) (this=this@entry=0x55a080960b60, toBePainted=...) at kernel/qwidget.cpp:5715
      #17 0x00007f4fb546274a in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (this=this@entry=0x55a080960b60, pdev=0x55a07f800450, rgn=..., offset=..., flags=flags@entry=36, sharedPainter=sharedPainter@entry=0x0, backingStore=<optimized out>) at kernel/qwidget.cpp:5655
      #18 0x00007f4fb5439dee in QWidgetBackingStore::doSync() (this=this@entry=0x55a0803d0c50) at kernel/qwidgetbackingstore.cpp:1375
      #19 0x00007f4fb543a095 in QWidgetBackingStore::sync() (this=0x55a0803d0c50) at kernel/qwidgetbackingstore.cpp:1162
      #20 0x00007f4fb545166f in QWidgetPrivate::syncBackingStore() (this=0x55a07e717470) at kernel/qwidget.cpp:1973
      #21 0x00007f4fb54691a8 in QWidget::event(QEvent*) (this=this@entry=0x55a07e50e5e0, event=event@entry=0x7f4fa4013740) at kernel/qwidget.cpp:9219
      #22 0x00007f4fb557cc4b in QMainWindow::event(QEvent*) (this=0x55a07e50e5e0, event=0x7f4fa4013740) at widgets/qmainwindow.cpp:1563
      #23 0x00007f4fb542a82c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x55a07e311d20, receiver=receiver@entry=0x55a07e50e5e0, e=e@entry=0x7f4fa4013740) at kernel/qapplication.cpp:3722
      #24 0x00007f4fb54320f4 in QApplication::notify(QObject*, QEvent*) (this=0x7ffe2716c7d0, receiver=0x55a07e50e5e0, e=0x7f4fa4013740) at kernel/qapplication.cpp:3481
      #25 0x00007f4fb43209a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55a07e50e5e0, event=event@entry=0x7f4fa4013740) at kernel/qcoreapplication.cpp:1024
      #26 0x00007f4fb432311d in QCoreApplication::sendEvent(QObject*, QEvent*) (event=0x7f4fa4013740, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:233
      #27 0x00007f4fb432311d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55a07e311820) at kernel/qcoreapplication.cpp:1699
      #28 0x00007f4fb43236a8 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1553
      #29 0x00007f4fb437a2c3 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55a07e3e5050) at kernel/qeventdispatcher_glib.cpp:276
      #30 0x00007f4fb1295287 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
      #31 0x00007f4fb12954c0 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
      #32 0x00007f4fb129554c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
      #33 0x00007f4fb43798ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55a07e3c9fd0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
      #34 0x00007f4fb431e9ea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffe2716c4e0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
      #35 0x00007f4fb4327a84 in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1297
      #36 0x000055a07cb8df92 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ./src/app/main.cpp:537

      Attachments

        1. cpu-high-1.png
          8 kB
          John Lindgren
        2. cpu-high-2.png
          8 kB
          John Lindgren
        3. cpu-low-1.png
          8 kB
          John Lindgren
        4. cpu-low-2.png
          8 kB
          John Lindgren

        Activity

          People

            davschul David Schulz
            john.lindgren@aol.com John Lindgren
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: