Bug 420075 - KMail/Kontact extremely slow to reply to long email thread
Summary: KMail/Kontact extremely slow to reply to long email thread
Status: REPORTED
Alias: None
Product: kontact
Classification: Applications
Component: mail (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-14 10:28 UTC by Aaron Williams
Modified: 2022-08-23 13:23 UTC (History)
3 users (show)

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 Aaron Williams 2020-04-14 10:28:28 UTC
SUMMARY

On a number of email threads when I open them to reply KMail will freeze for many minutes consuming 100% of the CPU. Eventually it will unfreeze and I can type a little, but it very frequently freezes. These freezes can last for many minutes.

This is on a 12 core Threadripper system with 96GB of RAM and a SSD.

STEPS TO REPRODUCE
1. Reply to a long email involved in a long thread
2. Wait
3. Wait
Do some stuff until it freezes again (it doesn't take much)

OBSERVED RESULT


EXPECTED RESULT
There should be no long freezes or hangs like I am experiencing.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: OpenSUSE 15.1
(available in About System)
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 
Qt Version: 5.14.1

ADDITIONAL INFORMATION
(gdb) info threads
  Id   Target Id                                           Frame
* 1    Thread 0x7fe183b0a980 (LWP 38251) "kontact"         0x00007fe18153bc03 in QFragmentMapData<QTextBlockData>::position (field=0, node=<optimized out>, this=<optimized out>)
    at ../../include/QtGui/5.14.1/QtGui/private/../../../../../src/gui/text/qfragmentmap_p.h:124
  2    Thread 0x7fe158a3b700 (LWP 38261) "QXcbEventQueue"  0x00007fe18030e69b in __GI___poll (
    fds=0x7fe158a3ab38, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  3    Thread 0x7fe14e47d700 (LWP 38273) "QDBusConnection" 0x00007fe18030e69b in __GI___poll (
    fds=0x7fe14801d200, nfds=10, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  4    Thread 0x7fe147743700 (LWP 38290) "sandbox_ipc_thr" 0x00007fe18030e69b in __GI___poll (
    fds=0x7fe147742ab0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  5    Thread 0x7fe146f42700 (LWP 38297) "kontact"         0x00007fe1802e62f7 in __GI___waitpid (
    pid=38293, stat_loc=0x7fe146f41c1c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
  6    Thread 0x7fe146741700 (LWP 38298) "ThreadPoolServi" 0x00007fe180319056 in __GI_epoll_pwait (
    epfd=34, events=events@entry=0x7fe130002000, maxevents=32, timeout=timeout@entry=2100000,
    set=set@entry=0x0) at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
  7    Thread 0x7fe14573f700 (LWP 38300) "Chrome_IOThread" 0x00007fe180319056 in __GI_epoll_pwait (
    epfd=35, events=events@entry=0x7fe134001fc0, maxevents=32, timeout=timeout@entry=-1,
    set=set@entry=0x0) at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
  8    Thread 0x7fe12f7fe700 (LWP 38304) "inotify_reader"  0x00007fe180310513 in __GI___select (
    nfds=45, readfds=0x7fe12f7fdb50, writefds=0x0, exceptfds=0x0, timeout=0x0)
    at ../sysdeps/unix/sysv/linux/select.c:41
  9    Thread 0x7fe12d7fa700 (LWP 38309) "CompositorTileW" 0x00007fe17c03b87d in futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x5556f21c5328)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  10   Thread 0x7fe12cff9700 (LWP 38310) "VideoCaptureThr" 0x00007fe17c03b87d in futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x7fe12cff8a38)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  11   Thread 0x7fe10ffff700 (LWP 38311) "Chrome_InProcGp" 0x00007fe17c03bbab in futex_reltimed_wait_cancelable (private=<optimized out>, reltime=0x7fe10fffe860, expected=0, futex_word=0x7fe10fffea28)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:142
  12   Thread 0x7fe10f7fe700 (LWP 38312) "Chrome_ChildIOT" 0x00007fe180319056 in __GI_epoll_pwait (
    epfd=48, events=events@entry=0x7fe104002000, maxevents=32, timeout=timeout@entry=-1,
    set=set@entry=0x0) at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
  13   Thread 0x7fe10e3a0700 (LWP 38328) "CacheThread_Blo" 0x00007fe180319056 in __GI_epoll_pwait (
    epfd=71, events=events@entry=0x7fe0f8002000, maxevents=32, timeout=timeout@entry=-1,
    set=set@entry=0x0) at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
  14   Thread 0x7fe10db9f700 (LWP 38329) "ThreadPoolSingl" 0x00007fe17c03b87d in futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x7fe10db9eb18)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  15   Thread 0x7fe10d39e700 (LWP 38344) "VizCompositorTh" 0x00007fe17c03b87d in futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x7fe10d39da38)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  16   Thread 0x7fe0ea53a700 (LWP 38350) "Qt bearer threa" 0x00007fe18030e69b in __GI___poll (
    fds=0x7fe0e4004a30, nfds=1, timeout=9983) at ../sysdeps/unix/sysv/linux/poll.c:29
  17   Thread 0x7fe0e96ad700 (LWP 38355) "SessionThread"   0x00007fe18030e69b in __GI___poll (
    fds=0x7fe0dc004e30, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  18   Thread 0x7fe0e8eac700 (LWP 38360) "SessionThread"   0x00007fe18030e69b in __GI___poll (
    fds=0x7fe0e005fe30, nfds=11, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  19   Thread 0x7fe0d5c0a700 (LWP 38385) "kontact"         0x00007fe18030a198 in __GI___libc_read (
    fd=91, buf=0x5556f261a2e3, nbytes=1) at ../sysdeps/unix/sysv/linux/read.c:26
  20   Thread 0x7fe0caebc700 (LWP 38493) "SessionThread"   0x00007fe18030e69b in __GI___poll (
    fds=0x7fe0c4004a30, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  21   Thread 0x7fe0c2832700 (LWP 38608) "QThread"         0x00007fe18030e69b in __GI___poll (
    fds=0x7fe0bc004e30, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  22   Thread 0x7fe0c2031700 (LWP 38609) "QLibProxyWrappe" syscall ()
    at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  23   Thread 0x7fe12effd700 (LWP 47388) "ThreadPoolSingl" 0x00007fe17c03b87d in futex_wait_cancelable (
    private=<optimized out>, expected=0, futex_word=0x7fe12effcb18)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  24   Thread 0x7fe12ffff700 (LWP 85211) "SessionThread"   0x00007fe18030e69b in __GI___poll (
    fds=0x7fe12800d2d0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  25   Thread 0x7fe144f3e700 (LWP 128957) "SessionThread"  0x00007fe18030e69b in __GI___poll (
    fds=0x7fe118006760, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  26   Thread 0x7fe12dffb700 (LWP 97005) "ThreadPoolForeg" 0x00007fe17c03bbab in futex_reltimed_wait_cancelable (private=<optimized out>, reltime=0x7fe12dffa940, expected=0, futex_word=0x7fe12dffab08)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:142

Backtrace of thread 1:
#0  0x00007fe18153bc03 in QFragmentMapData<QTextBlockData>::position(unsigned int, unsigned int) const
    (field=0, node=<optimized out>, this=<optimized out>)
    at ../../include/QtGui/5.14.1/QtGui/private/../../../../../src/gui/text/qfragmentmap_p.h:124
#1  0x00007fe18153bc03 in QFragmentMap<QTextBlockData>::position(unsigned int, unsigned int) const
    (field=0, node=22421, this=<optimized out>)
    at ../../include/QtGui/5.14.1/QtGui/private/../../../../../src/gui/text/qfragmentmap_p.h:857
#2  0x00007fe18153bc03 in QTextBlock::position() const (this=this@entry=0x7ffdb9b276e0)
    at text/qtextobject.cpp:1036
#3  0x00007fe18153c019 in QTextBlock::textDirection() const (this=this@entry=0x7ffdb9b276e0)
    at text/qtextobject.cpp:1186
#4  0x00007fe18157364a in QTextDocumentLayoutPrivate::layoutBlock(QTextBlock const&, int, QTextBlockFormat const&, QTextLayoutStruct*, int, int, QTextBlockFormat const*)
    (this=this@entry=0x555703446180, bl=..., blockPosition=blockPosition@entry=465160, blockFormat=..., layoutStruct=layoutStruct@entry=0x7ffdb9b27860, layoutFrom=layoutFrom@entry=150242, layoutTo=150257, previousBlockFormat=0x7ffdb9b276d0) at text/qtextdocumentlayout.cpp:3454
#5  0x00007fe181575084 in QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::iterator, QTextLayoutStruct*, int, int, QFixed)
    (this=this@entry=0x555703446180, it=..., layoutStruct=layoutStruct@entry=0x7ffdb9b27860, layoutFrom=layoutFrom@entry=150242, layoutTo=layoutTo@entry=150257, width=..., width@entry=...)
    at text/qtextdocumentlayout.cpp:3304
#6  0x00007fe18157b758 in QTextDocumentLayoutPrivate::layoutFrame(QTextFrame*, int, int, QFixed, QFixed, QFixed)
    (this=this@entry=0x555703446180, f=f@entry=0x55570b04d800, layoutFrom=layoutFrom@entry=150242, layoutTo=layoutTo@entry=150257, frameWidth=..., frameWidth@entry=..., frameHeight=..., parentY=...)
    at text/qtextdocumentlayout.cpp:3045
#7  0x00007fe18157bd60 in QTextDocumentLayoutPrivate::layoutFrame(QTextFrame*, int, int, QFixed)
    (this=this@entry=0x555703446180, f=f@entry=0x55570b04d800, layoutFrom=layoutFrom@entry=150242, layoutTo=layoutTo@entry=150257, parentY=..., parentY@entry=...) at text/qtextdocumentlayout.cpp:2935
#8  0x00007fe18157bf98 in QTextDocumentLayout::doLayout(int, int, int)
    (this=this@entry=0x5557086866f0, from=from@entry=150242, oldLength=oldLength@entry=15, length=length@entry=15) at text/qtextdocumentlayout.cpp:3851
#9  0x00007fe18157c8eb in QTextDocumentLayout::documentChanged(int, int, int)
    (this=0x5557086866f0, from=150242, oldLength=15, length=15) at text/qtextdocumentlayout.cpp:3814
#10 0x00007fe18154125d in QTextDocument::markContentsDirty(int, int)
    (this=this@entry=0x555707bc6590, from=<optimized out>, length=length@entry=15)
    at text/qtextdocument.cpp:644
#11 0x00007fe18159c714 in QSyntaxHighlighterPrivate::applyFormatChanges()
    (this=this@entry=0x555707bd5590) at text/qsyntaxhighlighter.cpp:155
#12 0x00007fe18159d118 in QSyntaxHighlighterPrivate::reformatBlock(QTextBlock const&)
    (this=this@entry=0x555707bd5590, block=...) at text/qsyntaxhighlighter.cpp:203
#13 0x00007fe18159d2b0 in QSyntaxHighlighterPrivate::reformatBlocks(int, int, int)
    (this=this@entry=0x555707bd5590, from=from@entry=0, charsRemoved=charsRemoved@entry=0, charsAdded=995149) at text/qsyntaxhighlighter.cpp:183
#14 0x00007fe18159d67f in QSyntaxHighlighterPrivate::rehighlight(QTextCursor&, QTextCursor::MoveOperation) (operation=QTextCursor::End, cursor=..., this=0x555707bd5590) at text/qsyntaxhighlighter.cpp:78
#15 0x00007fe18159d67f in QSyntaxHighlighter::rehighlight() (this=<optimized out>)
    at text/qsyntaxhighlighter.cpp:379
#16 0x00007fe16a9403dd in Sonnet::Highlighter::slotRehighlight() () at /usr/lib64/libKF5SonnetUi.so.5
#17 0x00007fe180e634d9 in doActivate<false>(QObject*, int, void**)
    (sender=0x55570769ca40, signal_index=3, argv=0x7ffdb9b27e20) at kernel/qobject.cpp:3882
#18 0x00007fe180e5dfb2 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=sender@entry=0x55570769ca40, m=m@entry=0x7fe1812e4cc0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffdb9b27e20) at kernel/qobject.cpp:3930
#19 0x00007fe180e672b7 in QTimer::timeout(QTimer::QPrivateSignal)
    (this=this@entry=0x55570769ca40, _t1=...) at .moc/moc_qtimer.cpp:205
#20 0x00007fe180e67618 in QTimer::timerEvent(QTimerEvent*) (this=0x55570769ca40, e=<optimized out>)
    at kernel/qtimer.cpp:257
#21 0x00007fe180e5b503 in QObject::event(QEvent*) (this=0x55570769ca40, e=0x7ffdb9b28180)
    at kernel/qobject.cpp:1361
#22 0x00007fe181d2fb5c in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    (this=this@entry=0x5556f1e3b3b0, receiver=receiver@entry=0x55570769ca40, e=e@entry=0x7ffdb9b28180)
    at kernel/qapplication.cpp:3684
#23 0x00007fe181d36d60 in QApplication::notify(QObject*, QEvent*)
    (this=0x7ffdb9b28500, receiver=0x55570769ca40, e=0x7ffdb9b28180) at kernel/qapplication.cpp:3430
#24 0x00007fe180e284c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    (receiver=0x55570769ca40, event=0x7ffdb9b28180) at kernel/qcoreapplication.cpp:1092
#25 0x00007fe180e86c59 in QTimerInfoList::activateTimers() (this=0x5556f1e90fe0)
    at kernel/qtimerinfo_unix.cpp:643
#26 0x00007fe180e87421 in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>)
    at kernel/qeventdispatcher_glib.cpp:183
#27 0x00007fe179c61e87 in g_main_dispatch (context=0x7fe154004fd0) at gmain.c:3142
#28 0x00007fe179c61e87 in g_main_context_dispatch (context=context@entry=0x7fe154004fd0) at gmain.c:3795
#29 0x00007fe179c62230 in g_main_context_iterate
    (context=context@entry=0x7fe154004fd0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3868
#30 0x00007fe179c622bc in g_main_context_iteration (context=0x7fe154004fd0, may_block=may_block@entry=1)
    at gmain.c:3929
#31 0x00007fe180e877cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
    (this=0x5556f1eaa880, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#32 0x00007fe180e26d4a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
    (this=this@entry=0x7ffdb9b283d0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#33 0x00007fe180e304c0 in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1400
#34 0x00005556f1ade785 in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/kontact-19.12.3-lp151.117.1.x86_64/src/main.cpp:229
Comment 1 atkinskev 2020-10-30 11:20:32 UTC
This seems to be affecting me too. I'm using with Office 365, everything is working, except loading a long threaded message for reply causes the issue already described.
Comment 2 Carsten Pfeiffer 2022-06-29 20:27:41 UTC
I can confirm this on Debian with
- Kontact 5.19.3 (21.12.3)
- KDE Frameworks 5.94.0
- Qt 5.15.4 (built against 5.15.4)

Every backtrace I take when it's stuck contains QSyntaxHighlighter::rehighlight().

And indeed, shortening the email makes the problem go away.

#0  0x00007f7bb7ded2f7 in QTextBlock::textDirection() const () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#1  0x00007f7bb7e25722 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#2  0x00007f7bb7e279a5 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#3  0x00007f7bb7e2f7a7 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#4  0x00007f7bb7e2fd9a in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#5  0x00007f7bb7e303c0 in QTextDocumentLayout::doLayout(int, int, int) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#6  0x00007f7bb7e3170b in QTextDocumentLayout::documentChanged(int, int, int) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#7  0x00007f7bb7df242d in QTextDocument::markContentsDirty(int, int) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#8  0x00007f7bb7e526bb in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#9  0x00007f7bb7e5305f in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007f7bb7e531f7 in ?? () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007f7bb7e53599 in QSyntaxHighlighter::rehighlight() () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007f7ba7de6431 in Sonnet::Highlighter::slotRehighlight() () from /lib/x86_64-linux-gnu/libKF5SonnetUi.so.5
#13 0x00007f7bb78de013 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f7bb78e1eca in QTimer::timeout(QTimer::QPrivateSignal) () from /lib/x86_64-linux-gnu/libQt5Core.so.5