Bug 492506 - kwin_wayland freezes, consumes 100% CPU, accepts no input
Summary: kwin_wayland freezes, consumes 100% CPU, accepts no input
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: master
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-01 17:29 UTC by Oded Arbel
Modified: 2024-10-22 20:59 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
coredump backtrace 1 (27.45 KB, text/plain)
2024-09-01 17:29 UTC, Oded Arbel
Details
core dump backtrace 2 (23.96 KB, text/plain)
2024-09-01 17:29 UTC, Oded Arbel
Details
full GDB backtrace 9092 (58.88 KB, text/plain)
2024-09-01 17:31 UTC, Oded Arbel
Details
perf capture 9092 (975.58 KB, application/gzip)
2024-09-01 17:33 UTC, Oded Arbel
Details
perf flame graph 9092 (596.94 KB, image/svg+xml)
2024-09-01 17:33 UTC, Oded Arbel
Details
Backtrace after sending QUIT when it's locked up (63.85 KB, text/x-log)
2024-09-15 14:02 UTC, dominik.klementowski
Details
journalctl output for plasma-kwin_wayland.service (12.89 KB, text/x-log)
2024-09-15 14:03 UTC, dominik.klementowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oded Arbel 2024-09-01 17:29:27 UTC
Created attachment 173208 [details]
coredump backtrace 1

SUMMARY
From time to time I get a case where kwin_wayland completely freezes: no screen updates (I can tell because I often have something running with progress reports, such as a script in the console or a download), no mouse movement, no keyboard input - not even VT switching.

If I SSH into the machine, I can see that kwin_wayland takes 100% CPU. From monitoring using perf and forced core dumps, it seems to be spending the time in harfbuzzNG under the QTextEngine::shapeTextWithHarfbuzzNG method.

STEPS TO REPRODUCE
I actually have no clue - it often happens when I'm doing something window-management intensive (lately its been when using Android Studio with multiple windows) but there's no specific use case.

OBSERVED RESULT
The entire computer appears to be frozen.

EXPECTED RESULT
?

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.1.80
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.8.0-41-generic (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
This has been happening since Plasma 6.0 but I'm now running 6.2 prerelease and still happens.

When sending SIGQUIT, I get a coredump that I can get a trace from. I also tried attaching to the running process with gdb to get stack traces, running perf, and looking at plasma-kwin_wayland.service logs (which was fruitless actually).

I'm going to add some attachment with data that I hope will be useful.

I often recover by killing kwin_wayland, which resets the session - keeping KDE apps and killing everything else, but its better than nothing (yay for wayland compositor handover!).
Comment 1 Oded Arbel 2024-09-01 17:29:48 UTC
Created attachment 173209 [details]
core dump backtrace 2
Comment 2 Oded Arbel 2024-09-01 17:31:25 UTC
Created attachment 173210 [details]
full GDB backtrace 9092
Comment 3 Oded Arbel 2024-09-01 17:33:18 UTC
Created attachment 173211 [details]
perf capture 9092
Comment 4 Oded Arbel 2024-09-01 17:33:39 UTC
Created attachment 173212 [details]
perf flame graph 9092
Comment 5 Oded Arbel 2024-09-01 17:42:50 UTC
More perf data and logs can be found in http://kwincrash.geek.co.il/
Comment 6 Oded Arbel 2024-09-08 06:54:25 UTC
I got another freeze - uploaded to http://kwincrash.geek.co.il as 2024-09-08-71504. The freeze happened when I used a keyboard shortcut to change a window's virtual desktop - the action did not happen, and instead the screen froze.

The log during the freeze shows this message a lot:

Sep 08 09:37:52 vesho kwin_wayland[3533]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug

I got a coredump using `killall -QUIT kwin_wayland`, where using the interactive debugger on it I got this stack trace:

#0  0x00007df8c1de5438 in QQuickItem::parentItem (this=0x5780a4976f00)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:2691
#1  0x00007df8a7257325 in QQuickLayoutAttached::parentLayout (this=this@entry=0x5780a4713be0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklayout.cpp:733
#2  0x00007df8a725bc52 in QQuickLayoutAttached::effectiveQMargins (this=0x5780a4713be0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklayout_p.h:283
#3  QQuickGridLayoutItem::setGeometry (this=0x5780a3983770, rect=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquickgridlayoutengine_p.h:74
#4  0x00007df8c03adacc in QGridLayoutEngine::setGeometries (styleInfo=<optimized out>, contentsGeometry=..., this=0x5780a4204808)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/util/qgridlayoutengine.cpp:1056
#5  QGridLayoutEngine::setGeometries (this=this@entry=0x5780a4204808, contentsGeometry=..., styleInfo=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/util/qgridlayoutengine.cpp:1022
#6  0x00007df8a725e48e in QQuickGridLayoutBase::rearrange (this=0x5780a490dcf0, size=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklinearlayout.cpp:477
#7  0x00007df8a725b1c2 in QQuickLayout::geometryChange (oldGeometry=..., newGeometry=..., this=0x5780a490dcf0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklayout.cpp:930
#8  QQuickLayout::geometryChange (this=0x5780a490dcf0, newGeometry=..., oldGeometry=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklayout.cpp:922
#9  0x00007df8c1df1abe in QQuickItem::setX (this=0x5780a490dcf0, v=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:7195
#10 0x00007df8c1dc6b8a in QQuickAnchorsPrivate::setItemX (v=<optimized out>, this=0x5780a41dd5c0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickanchors.cpp:370
#11 QQuickAnchorsPrivate::updateHorizontalAnchors (this=this@entry=0x5780a41dd5c0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickanchors.cpp:747
#12 0x00007df8c1dc6e69 in QQuickAnchorsPrivate::update (this=0x5780a41dd5c0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickanchors.cpp:445
#13 QQuickAnchorsPrivate::update (this=0x5780a41dd5c0) at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickanchors.cpp:434
#14 0x00007df8c1de4393 in QQuickAnchorsPrivate::updateMe (this=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickanchors.cpp:402
#15 QQuickItem::geometryChange (this=this@entry=0x5780a490dcf0, newGeometry=..., oldGeometry=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:3871
#16 0x00007df8a725b149 in QQuickLayout::geometryChange (this=0x5780a490dcf0, newGeometry=..., oldGeometry=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicklayouts/qquicklayout.cpp:925
#17 0x00007df8c1df1ffe in QQuickItem::setWidth (this=0x5780a490dcf0, w=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:7300
#18 0x00007df8c1e1ba84 in QQuickItemPrivate::setWidth (width=<optimized out>, this=0x5780a4204680)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem_p.h:227
#19 QObjectCompatProperty<QQuickItemPrivate, double, &QQuickItemPrivate::_qt_property_width_offset, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged, decltype(nullptr)>::bindingWrapper(QMetaType, QUntypedPropertyData*, QtPrivate::QPropertyBindingFunction) (type=..., dataPtr=0x5780a42047b0, binding=...)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/6.7.2/QtCore/private/qproperty_p.h:540
#20 0x00007df8bfd8f7d8 in QPropertyBindingPrivate::evaluateRecursive_inline (status=<optimized out>, bindingObservers=<optimized out>, this=0x5780a4c85850)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qproperty_p.h:860
#21 QPropertyObserverPointer::evaluateBindings(QVarLengthArray<QBindingObserverPtr, 256ll>&, QBindingStatus*) [clone .isra.0]
    (bindingObservers=..., status=status@entry=0x7df8b88b94e0, this=0x5780a3f95418)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qproperty.cpp:809
#22 0x00007df8bfd8f6ea in QPropertyBindingPrivate::evaluateRecursive_inline (status=<optimized out>, bindingObservers=<optimized out>, this=0x5780a3f953a0)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qproperty_p.h:872
#23 QPropertyObserverPointer::evaluateBindings(QVarLengthArray<QBindingObserverPtr, 256ll>&, QBindingStatus*) [clone .isra.0]
    (bindingObservers=..., status=0x7df8b88b94e0, this=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qproperty.cpp:809
#24 0x00007df8bfc0b1ab in QtPrivate::QPropertyBindingData::notifyObserver_helper
    (this=this@entry=0x5780a3974598, propertyDataPtr=propertyDataPtr@entry=0x5780a37ecda0, storage=storage@entry=0x5780a37eccb0, observer=observer@entry=..., bindingObservers=...) at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qproperty.cpp:667
#25 0x00007df8c1e10c65 in QObjectCompatProperty<QQuickItemPrivate, double, &QQuickItemPrivate::_qt_property_width_offset, &QQuickItemPrivate::setWidth, &QQuickItemPrivate::widthChanged, decltype(nullptr)>::notify() (this=0x5780a37ecda0) at /usr/include/x86_64-linux-gnu/qt6/QtCore/6.7.2/QtCore/private/qproperty_p.h:670
#26 0x00007df8c1de4568 in QQuickItem::geometryChange (this=0x5780a3789100, newGeometry=<optimized out>, oldGeometry=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:3891
#27 0x00007df8c1dd6a77 in QQuickFlickable::geometryChange (this=0x5780a3789100, newGeometry=..., oldGeometry=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickflickable.cpp:2075
#28 0x00007df8c1df308f in QQuickItem::setSize (this=this@entry=0x5780a3789100, size=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:7684
#29 0x00007df8b77ed785 in QQuickControlPrivate::resizeContent (this=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicktemplates/qquickcontrol.cpp:374
#30 0x00007df8b77e8d9d in QQuickControl::paddingChange (this=<optimized out>, newPadding=<optimized out>, oldPadding=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicktemplates/qquickcontrol.cpp:2133
#31 0x00007df8b77e287d in QQuickControlPrivate::setRightPadding (this=0x5780a17ee700, value=<optimized out>, reset=false)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicktemplates/qquickcontrol.cpp:223
#32 0x00007df8c143b0b3 in QQmlPropertyData::writeProperty (this=<optimized out>, target=<optimized out>, value=<optimized out>, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlpropertydata_p.h:336
#33 0x00007df8c152713a in GenericBinding<6>::write (this=0x5780a3767db0, result=0x7fff4ac58f40, type=..., isUndefined=<optimized out>, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:210
#34 0x00007df8c14e1b42 in QQmlBinding::doUpdate (this=0x5780a3767db0, watcher=..., flags=..., scope=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:690
#35 0x00007df8c14ded76 in QQmlBinding::update (this=0x5780a3767db0, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:164
#36 0x00007df8c145235c in QQmlNotifier::emitNotify (endpoint=<optimized out>, a=0x0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlnotifier.cpp:70
#37 0x00007df8bfc64780 in doActivate<false> (sender=0x5780a37df540, signal_index=19, argv=0x0)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:3976
#38 0x00007df8c1df4128 in QQuickItemPrivate::setEffectiveVisibleRecur (this=this@entry=0x5780a38bf4c0, newEffectiveVisible=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:6620
#39 0x00007df8c1df418f in QQuickItemPrivate::setVisible (this=0x5780a38bf4c0, visible=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitem.cpp:6507
#40 0x00007df8c143b0b3 in QQmlPropertyData::writeProperty (this=<optimized out>, target=<optimized out>, value=<optimized out>, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlpropertydata_p.h:336
#41 0x00007df8c152776a in GenericBinding<1>::write (this=0x5780a380bf20, result=0x7fff4ac5ac30, type=..., isUndefined=<optimized out>, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:210
#42 0x00007df8c14e1b42 in QQmlBinding::doUpdate (this=0x5780a380bf20, watcher=..., flags=..., scope=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:690
#43 0x00007df8c14ded76 in QQmlBinding::update (this=0x5780a380bf20, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:164
#44 0x00007df8c145235c in QQmlNotifier::emitNotify (endpoint=<optimized out>, a=0x0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlnotifier.cpp:70
#45 0x00007df8bfc64780 in doActivate<false> (sender=0x5780a37df540, signal_index=62, argv=0x0)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:3976
#46 0x00007df8b7770739 in QQuickScrollBar::setSize (this=0x5780a37df540, size=1)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quicktemplates/qquickscrollbar.cpp:422
#47 0x00007df8bfc64f0d in doActivate<false> (sender=0x5780a3832cf0, signal_index=6, argv=0x7fff4ac5c8d0)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:4098
#48 0x00007df8c1dcc0a5 in QQuickFlickableVisibleArea::heightRatioChanged (this=<optimized out>, _t1=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/obj-x86_64-linux-gnu/src/quick/Quick_autogen/include/moc_qquickflickable_p_p.cpp:250
#49 0x00007df8c1accd94 in QQuickItemViewPrivate::layout (this=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickitemview.cpp:1930
#50 0x00007df8c1d89e8a in QQuickWindowPrivate::polishItems (this=0x5780a2efb620)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/items/qquickwindow.cpp:369
#51 0x00007df8c1c91603 in QSGGuiThreadRenderLoop::renderWindow (this=0x5780a2db7fe0, window=0x5780a2e65fe0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/quick/scenegraph/qsgrenderloop.cpp:616
#52 0x00007df8c011dea9 in QWindow::event (this=0x5780a2e65fe0, ev=0x7fff4ac5cf80)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/kernel/qwindow.cpp:2600
#53 0x00007df8c0dff2b0 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5780a2e65fe0, e=0x7fff4ac5cf80)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/widgets/kernel/qapplication.cpp:3287
#54 0x00007df8bfca4fd0 in QCoreApplication::notifyInternal2 (receiver=0x5780a2e65fe0, event=0x7fff4ac5cf80)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qcoreapplication.cpp:1142
#55 0x00007df8bfca575d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qcoreapplication.cpp:1597
#56 0x00007df8c00cdc15 in QGuiApplicationPrivate::processExposeEvent (e=0x5780a45b9a60)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/kernel/qguiapplication.cpp:3298
#57 0x00007df8c012dd5c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/kernel/qwindowsysteminterface.cpp:1114
#58 0x00007df8c012def8 in QWindowSystemInterface::flushWindowSystemEvents (flags=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/kernel/qwindowsysteminterface.cpp:1083
#59 0x00007df8c0108514 in QPlatformWindow::setVisible (this=0x5780a34df650, visible=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/global/qflags.h:74
#60 0x00007df8c143b0b3 in QQmlPropertyData::writeProperty (this=<optimized out>, target=<optimized out>, value=<optimized out>, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlpropertydata_p.h:336
#61 0x00007df8c1527563 in GenericBinding<1>::doStore<bool> (flags=..., pd=<optimized out>, value=<optimized out>, this=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:275
#62 GenericBinding<1>::write (this=0x5780a37ddd70, result=..., isUndefined=false, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:238
#63 0x00007df8c14e172d in QQmlBinding::doUpdate (this=0x5780a37ddd70, watcher=..., flags=..., scope=<optimized out>)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:701
#64 0x00007df8c14ded76 in QQmlBinding::update (this=0x5780a37ddd70, flags=...)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlbinding.cpp:164
#65 0x00007df8c145235c in QQmlNotifier::emitNotify (endpoint=<optimized out>, a=0x0)
    at /usr/src/qt6-declarative-6.7.2-0zneon+24.04+noble+unstable+build2/src/qml/qml/qqmlnotifier.cpp:70
#66 0x00007df8bfc64780 in doActivate<false> (sender=0x5780a17ecfd0, signal_index=3, argv=0x0)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:3976
#67 0x00007df8c25b3f8c in KWin::TabBox::SwitcherItem::visibleChanged (this=0x5780a17ecfd0)
    at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/obj-x86_64-linux-gnu/src/kwin_autogen/include/moc_switcheritem.cpp:347
#68 KWin::TabBox::SwitcherItem::setVisible (visible=true, this=0x5780a17ecfd0)
    at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/tabbox/switcheritem.cpp:69
#69 KWin::TabBox::TabBoxHandlerPrivate::show (this=0x5780a1b56fd0) at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/tabbox/tabboxhandler.cpp:310
#70 KWin::TabBox::TabBoxHandler::show (this=0x5780a1c77190) at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/tabbox/tabboxhandler.cpp:358
#71 KWin::TabBox::TabBox::show (this=<optimized out>) at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/tabbox/tabbox.cpp:487
#72 KWin::TabBox::TabBox::show (this=<optimized out>) at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/tabbox/tabbox.cpp:477
#73 0x00007df8bfc64d34 in QtPrivate::QSlotObjectBase::call
    (a=0x7fff4ac5ef60, r=0x5780a1a95190, this=0x5780a1bb5f60, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobjectdefs_impl.h:469
#74 doActivate<false> (sender=0x5780a1a951b8, signal_index=3, argv=0x7fff4ac5ef60)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:4086
#75 0x00007df8bfc1576d in QTimer::timeout (this=<optimized out>, _t1=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/obj-x86_64-linux-gnu/src/corelib/Core_autogen/include/moc_qtimer.cpp:224
#76 0x00007df8bfbf7916 in QObject::event (this=0x5780a1a951b8, e=0x7fff4ac5f100)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qobject.cpp:1427
#77 0x00007df8c0dff2b0 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5780a1a951b8, e=0x7fff4ac5f100)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/widgets/kernel/qapplication.cpp:3287
#78 0x00007df8bfca4fd0 in QCoreApplication::notifyInternal2 (receiver=0x5780a1a951b8, event=0x7fff4ac5f100)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qcoreapplication.cpp:1142
#79 0x00007df8bfb79cc8 in QTimerInfoList::activateTimers (this=0x5780a1784828)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qtimerinfo_unix.cpp:434
#80 0x00007df8bfb79f70 in QEventDispatcherUNIXPrivate::activateTimers (this=<optimized out>)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qeventdispatcher_unix.cpp:196
#81 0x00007df8bfb7ca0a in QEventDispatcherUNIX::processEvents (this=<optimized out>, flags=..., flags@entry=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/kernel/qeventdispatcher_unix.cpp:472
#82 0x00007df8c0519892 in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/platform/unix/qunixeventdispatcher.cpp:27
#83 0x00007df8bfcaff43 in QEventLoop::exec (this=0x7fff4ac5f2f0, flags=...)
    at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/global/qflags.h:34
#84 0x00007df8bfca996e in QCoreApplication::exec () at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/corelib/global/qflags.h:74
#85 0x00007df8c00c699d in QGuiApplication::exec () at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/gui/kernel/qguiapplication.cpp:1926
#86 0x00007df8c0df7129 in QApplication::exec () at /usr/src/qt6-base-6.7.2-0zneon+24.04+noble+unstable+build1/src/widgets/kernel/qapplication.cpp:2555
#87 0x000057809f992466 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/kwin-4:6.1.4+p24.04+vunstable+git20240821.1448-0/src/main_wayland.cpp:634
Comment 7 dominik.klementowski 2024-09-15 13:59:37 UTC
It appears to be specific to Ubuntu/Neon base as I could reproduce the problem on Ubuntu 22.04 and Ubuntu 24.04 both with Plasma compiled from source and using Neon's repositories for `noble`. I can't reproduce this on same Plasma (6.1.5) Frameworks (6.5.0) and Qt (6.7.2) on Arch Linux (but I only try with different machine, maybe I'll setup Neon on my unaffected laptop with Arch if further investigation is needed).

I think I've found a way to reproduce it. For me it rarely happens itself when just using the laptop's screen, but I can reproduce it 100% of the time when I do the following:

1. Connect an additional screen over HDMI or DP
2. Suspend the machine and remove the screen at the same time (behavior like this can also happen when disconnecting screen with lid being closed)
3. Resume it from sleep
4. If it's frozen then go to 7.
5. Wait a couple of seconds after it resumes and it should lockup, if that's the case go to 7.
6. If it's still not locked up, it will right after connecting the screen back (even though it continues to display whatever was the last frame before lockup)
7. Done

The observed result is just like OP's describing. No frame updates ever again and no reaction to any input, even trying to swith to other TTY doesn't work. I can SSH on the machine and kwin_wayland occupies 100% of a CPU thread. Killing kwin_wayland brings it back and it continues to work normally, unless trying to reproduce.

I also tried to get traces out of kwin when it locks up. If I can provide something more useful, let me know. Since I still have plasma installation compiled from source.
Comment 8 dominik.klementowski 2024-09-15 14:02:18 UTC
Created attachment 173685 [details]
Backtrace after sending QUIT when it's locked up
Comment 9 dominik.klementowski 2024-09-15 14:03:59 UTC
Created attachment 173686 [details]
journalctl output for plasma-kwin_wayland.service
Comment 10 dominik.klementowski 2024-09-15 14:40:30 UTC
What I noticed, is that my stack trace is different from OPs. Mine clearly points to this: https://invent.kde.org/plasma/kwin/-/blob/master/src/backends/drm/drm_commit_thread.cpp?ref_type=heads#L45

Looks like it never gets out of that `while (true)` and waiting for something that doesn't seem to be happening. Maybe it's because of some Ubuntu-specific patches to the kernel/drm library, but I don't know where to dig.

Interestingly, OP attached this piece of log:
>Sep 08 09:37:52 vesho kwin_wayland[3533]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug

The error message comes from just 5 lines below of what my stack trace is pointing to (I checked and it only occurs once in the entire kwin source code), so looks like this is where the looping happens in both of our cases.
Comment 11 Oded Arbel 2024-09-15 16:33:53 UTC
Interesting repro. I don't see `drm_commit_thread.cpp` in my stack traces, though it may be related. I see that the `drm_commit_thread.cpp` is not in the main thread - next time I get a freeze I will try to identify the thread that is busy looping - though from the flame graph I believe it is the harfbuzz renderer on the main thread.

While all of the repros on my device are with external screens  dominik.klementowski@protonmail.com connected to a laptop, I don't believe connecting/disconnecting has anything to do with that it - and specifically on another device I got a freeze with just an internal laptop screen that was never connected to an external screen.

All in all, I think my report is a different issue than dominik.klementowski@protonmail.com 's - but if that ever get fixed I'm OK with closing this issue - until I can repro it again 😏.
Comment 12 dominik.klementowski 2024-09-15 20:45:43 UTC
I'm not saying I'm sure 100% that this is the same problem, but what matches is exact same base system with its kernel and symptoms. Also, I daily drive recent Plasma on two additional systems (Arch and Nobara), everything is in exact same versions and they're unaffected.

And yes, for me it happened randomly at least once when I was just using the laptop's built in screen. Looks like changing screens/modes and suspend can help trigger this behavior. My bet is that you would be able to reproduce it on your end with the same steps.

In the meantime, I'll try to reproduce it on a different hardware with Neon and see if replacing kernel with mainline can resolve it. That could potentially bring some more clues.
Comment 13 dominik.klementowski 2024-09-16 00:49:12 UTC
I tried couple of different things:

  - Tried upstream kernel 6.6.42 and liquorix - no change
  - Tried mainline libdrm 2.4.123, recompiled kwin against it - no change
  - Tried mainline Mesa from kisak-mesa ppa - nope, still nothing

At this point I might go and compile every other non-Qt library that kwin uses and recompile everything
Comment 14 Oded Arbel 2024-09-16 08:21:46 UTC
(In reply to dominik.klementowski from comment #13)
> I tried couple of different things:
> 
>   - Tried upstream kernel 6.6.42 and liquorix - no change
>   - Tried mainline libdrm 2.4.123, recompiled kwin against it - no change
>   - Tried mainline Mesa from kisak-mesa ppa - nope, still nothing
> 
> At this point I might go and compile every other non-Qt library that kwin
> uses and recompile everything

Is the idea here that the problem is a bad interaction between kwin and a  bug in another component, that was already fixed in the component's upstream?
Comment 15 dominik.klementowski 2024-09-16 09:06:58 UTC
> (In reply to dominik.klementowski from comment #13)
> 
> Is the idea here that the problem is a bad interaction between kwin and a 
> bug in another component, that was already fixed in the component's upstream?

Yes, that was the idea for trying different things as the problem doesn't seem to be present on other distros, but I don't have any way to test other systems on this specific hardware, so it could still be just a kwin bug that only manifests itself on certain hardware configurations.
Comment 16 David Redondo 2024-09-17 11:53:03 UTC
Oded, which task switcher theme are you using? Did you notice that it happens if you open the taskswitcher the backtrace seems to indicate that?
Comment 17 Bug Janitor Service 2024-10-02 03:47:24 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 18 Oded Arbel 2024-10-06 14:35:04 UTC
(In reply to David Redondo from comment #16)
> Oded, which task switcher theme are you using? Did you notice that it
> happens if you open the taskswitcher the backtrace seems to indicate that?

I'm using Sidebar, as the default "Thumbnail Grid" isn't working on my system for some reason (I get an error notification and no switcher UI).

I believe I had freezes that did not involve window switching, though I definitely had ones that did.
Comment 19 Oded Arbel 2024-10-17 14:48:09 UTC
Yesterday I got like 5 more crashes, within a couple of hours of work. I stopped bothering capturing debug data after the second one (after getting 3 freezes in less than 30 minutes), but I uploaded two new traces to the http://kwincrash.geek.co.il directory.

Looking at the flame graphs for the perf data, in all cases most of the time is spent under QQuickFlickableVisibleArea::heightRatioChanged  - which calls (I'm guessing) a hierarchy of QQuick items, where each is running its `setSize()` method - but as this is notably something like 90% of processing during a 30 seconds duration. Seems to me that its likely that QSGGuiThreadRenderLoop::renderWindow is being run and/or running the QQuick re-render loop continuously without stopping for actual rendering or input.