Bug 482429

Summary: kwin_wayland crashes on single hdmi screen reconnect
Product: [Plasma] kwin Reporter: alain
Component: generic-crashAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: crash CC: kv3f5ves, xaver.hugl
Priority: NOR    
Version First Reported In: 5.27.10   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description alain 2024-03-05 01:41:48 UTC
SUMMARY

On a desktop with a single monitor attached, when the HDMI cable is disconnected (or, in my case, the kvm switch switched to the other computer) and later reconnected, kwin_wayland crashes.

STEPS TO REPRODUCE
1. Unplug, or hit the KVM switch, while a session is active.
2. After a little while (presumably long enough for an attempt to put the monitor to sleep has been made), reconnect the monitor.

OBSERVED RESULT
kwin_wayland crashed and dumps its core.

EXPECTED RESULT
kwin_wayland doesn't crash.

SOFTWARE/OS VERSIONS
Système d'exploitation : Manjaro Linux 
Version de KDE Plasma : 5.27.10
Version de KDE Frameworks : 5.115.0
Version de Qt : 5.15.12
Version de noyau : 6.6.16-2-MANJARO (64-bit)
Plate-forme graphique : Wayland
Processeurs : 16 × AMD Ryzen 7 5800H with Radeon Graphics
Mémoire : 28,3 Gio de mémoire vive
Processeur graphique : AMD Radeon Graphics
Fabricant : AZW
Nom du produit : SER

ADDITIONAL INFORMATION

- Backtrace:
#0  0x00007f5a56aab32c in ??? () at /usr/lib/libc.so.6
#1  0x00007f5a56a5a6c8 in raise () at /usr/lib/libc.so.6
#2  0x00007f5a56a424b8 in abort () at /usr/lib/libc.so.6
#3  0x00007f5a56cdd3b2 in std::__glibcxx_assert_fail
    (file=file@entry=0x7f5a59707cc8 "/usr/include/c++/13.2.1/bits/stl_algo.h", line=line@entry=3669, function=function@entry=0x7f5a59707c70 "constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&) [with _Tp = double]", condition=condition@entry=0x7f5a597008d9 "!(__hi < __lo)")
    at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:61
#4  0x00007f5a594f86b0 in std::clamp<double> (__val=<optimized out>, __lo=<optimized out>, __hi=<optimized out>) at /usr/include/c++/13.2.1/bits/stl_algo.h:3667
#5  std::clamp<double> (__hi=<optimized out>, __lo=<optimized out>, __val=<optimized out>) at /usr/include/c++/13.2.1/bits/stl_algo.h:3667
#6  KWin::Window::constrainClientSize (this=0x55b377079ac0, size=<optimized out>, mode=<optimized out>) at /usr/src/debug/kwin/kwin-5.27.10/src/window.cpp:4278
#7  0x00007f5a594fa415 in KWin::Window::constrainFrameSize (this=this@entry=0x55b377079ac0, size=..., mode=mode@entry=KWin::Window::SizeModeAny)
    at /usr/src/debug/kwin/kwin-5.27.10/src/window.cpp:4290
#8  0x00007f5a59500eef in KWin::Window::checkWorkspacePosition (this=<optimized out>, oldGeometry=..., oldDesktop=<optimized out>)
    at /usr/src/debug/kwin/kwin-5.27.10/src/window.cpp:4236
#9  0x00007f5a59523d39 in KWin::Workspace::updateClientArea (this=this@entry=0x55b375d2f9e0) at /usr/src/debug/kwin/kwin-5.27.10/src/workspace.cpp:2441
#10 0x00007f5a59524ad2 in KWin::Workspace::desktopResized (this=<optimized out>) at /usr/src/debug/kwin/kwin-5.27.10/src/workspace.cpp:2224
#11 0x00007f5a5951aa5d in KWin::Workspace::updateOutputs (this=0x55b375d2f9e0, outputOrder=<optimized out>)
    at /usr/src/debug/kwin/kwin-5.27.10/src/workspace.cpp:1432
#12 0x00007f5a5950ed84 in KWin::Workspace::slotOutputBackendOutputsQueried (this=0x55b375d2f9e0) at /usr/src/debug/kwin/kwin-5.27.10/src/workspace.cpp:1327
#13 0x00007f5a57ad0e27 in ??? () at /usr/lib/libQt5Core.so.5
#14 0x00007f5a5956bfcf in KWin::DrmBackend::updateOutputs (this=<optimized out>) at /usr/src/debug/kwin/kwin-5.27.10/src/backends/drm/drm_backend.cpp:333
#15 0x00007f5a59565497 in KWin::DrmBackend::handleUdevEvent (this=<optimized out>) at /usr/src/debug/kwin/kwin-5.27.10/src/backends/drm/drm_backend.cpp:259
#16 0x00007f5a57ad0e27 in ??? () at /usr/lib/libQt5Core.so.5
#17 0x00007f5a57ad2624 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#18 0x00007f5a57ad2768 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#19 0x00007f5a571788ff in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#20 0x00007f5a57a9bef8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#21 0x00007f5a57ae98cc in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () at /usr/lib/libQt5Core.so.5
#22 0x00007f5a57aeaa99 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#23 0x000055b373d1ded2 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#24 0x00007f5a57a9ac04 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#25 0x00007f5a57a9c0a3 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#26 0x000055b373c3940b in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kwin/kwin-5.27.10/src/main_wayland.cpp:628
Comment 1 Vlad Zahorodnii 2024-03-05 10:28:16 UTC
Is this crash reproducible in Plasma 6?
Comment 2 alain 2024-03-05 14:34:37 UTC
I haven't tried Plasma 6 yet but I will and report back.

Additional information: I made a wrong assumption about my KVM switch. With the switch set to computer B, I thought the screen would appear disconnected on computer A, but it doesn't. kscreen-doctor --outputs still shows

Output: 5 HDMI-A-1 enabled connected priority 1 HDMI Modes: 0:1920x1080@60*! 1:1920x1080@60 2:1920x1080@60 3:1920x1080@50 4:1680x1050@60 5:1600x900@60 6:1280x1024@60 7:1440x900@60 8:1280x800@60 9:1280x720@60 10:1280x720@60 11:1280x720@60 12:1280x720@50 13:1280x720@50 14:1024x768@70 15:1024x768@60 16:800x600@72 17:800x600@60 18:800x600@56 19:720x576@50 20:720x576@50 21:720x480@60 22:720x480@60 23:720x480@60 24:720x480@60 25:640x480@73 26:640x480@67 27:640x480@60 28:640x480@60 29:720x400@70 30:1280x1024@60 31:1024x768@60 32:1280x800@60 33:1920x1080@60 34:1600x900@60 35:1368x768@60 36:1280x720@60 Geometry: 0,0 1920x1080 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown

As opposed to physically yanking the HDMI cable from the switch: in that case kscreen-doctor --outputs shows nothing.

The issue seems to occur only when connected to the KVM switch.
Comment 3 alain 2024-03-05 22:34:24 UTC
(In reply to Vlad Zahorodnii from comment #1)
> Is this crash reproducible in Plasma 6?

Using the KDE Neon unstable ISO, I can't reproduce the issue.
Comment 4 alain 2024-03-07 12:13:33 UTC
I noticed the crash seems to only occur when ktimetracker is active, even though I can't find anything relevant in the logs.