Bug 442706 - [Plasma][Wayland] Constant micro-reloading of Plasmashell cripples Wayland sessions making it unusable
Summary: [Plasma][Wayland] Constant micro-reloading of Plasmashell cripples Wayland se...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://gitlab.freedesktop.org/drm/am...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-19 18:34 UTC by temptempor
Modified: 2021-09-27 14:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
System logs and udevadm monitor logs (510.00 KB, application/gzip)
2021-09-22 09:34 UTC, temptempor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description temptempor 2021-09-19 18:34:20 UTC
SUMMARY

I'm only putting "Normal" severity because I haven't seen many complaints about 
this but Plasma on Wayland is useless for me with this bug as it is.


Plasma constantly re-detects my screens, creating some sort of micro-stutter all over the session (interrupts keystrokes as well as it steals focus from the current window).

It does so on Xorg, polluting my logs as well, but it poses real problems on the Wayland session.

After enough time of this behaviour, PlasmaShell will eventually crash:

[...]
QObject::connect: Cannot queue arguments of type 'Consumer::ServiceStatus'
(Make sure 'Consumer::ServiceStatus' is registered using qRegisterMetaType().)
kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x56130a032c30)
kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x56130a032c30)
kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x56130a032c30)
file:///usr/lib/qt/qml/org/kde/plasma/components/ModelContextMenu.qml:38:1: QML ModelContextMenu: Accessible must be attached to an Item
wl_display@1: error 0: invalid object 2015
The Wayland connection experienced a fatal error: Argument invalide

[...]

Culminating at some ~2GB RAM when it does usually.



STEPS TO REPRODUCE
1. Have 2 monitors. Have them plugged in with one suspended (off from an XRENDER PoV)
2. Use Plasma 5.22.x
3. Observe UI being weirdly refresh every ~5 secs and loosing focus

OBSERVED RESULT

Session is hardly usable

EXPECTED RESULT

Normal operation like under Xorg.

SOFTWARE/OS VERSIONS

Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 31.3 Gio of RAM
Graphics Processor: AMD Radeon RX 6900 XT

ADDITIONAL INFORMATION

Video illustration: https://transfert.free.fr/download/Pa9fks7MSljLYVzYP5UqbatpUY
Comment 1 Nate Graham 2021-09-21 21:43:33 UTC
Any chance you can try the Plasma 5.23 beta and see if it's any better there? A *lot* of Wayland improvements have made it into that release.
Comment 2 temptempor 2021-09-21 22:10:00 UTC
I'm on Arch Linux and it appears official unstable builds "https://download.kde.org/unstable/plasma/" aren't updated with 5.23 yet.
Comment 3 Vlad Zahorodnii 2021-09-22 06:58:43 UTC
> Plasma constantly re-detects my screens, creating some sort of micro-stutter all

> Normal operation like under Xorg.

If plasma constantly redetects outputs, it's **not** normal. Can you check udev events please? `sudo udevadm monitor`
Comment 4 temptempor 2021-09-22 09:34:04 UTC
Created attachment 141788 [details]
System logs and udevadm monitor logs

(In reply to Vlad Zahorodnii from comment #3)
> > Plasma constantly re-detects my screens, creating some sort of micro-stutter all
> 
> > Normal operation like under Xorg.
> 
> If plasma constantly redetects outputs, it's **not** normal. Can you check
> udev events please? `sudo udevadm monitor`

Yeah I meant it in a way that even if switching on my second monitor is painful in the settings on X11 session, the session itself is relatively unaffected.

However on Wayland, it appears to be deadly for the session after some time.
Comment 5 Vlad Zahorodnii 2021-09-22 10:30:59 UTC
KERNEL[156222.155457] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156222.157532] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156223.210818] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156223.211969] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156232.505832] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156232.508054] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156233.570940] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156233.572104] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156242.845773] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156242.847666] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156243.911096] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156243.912215] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156253.215878] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156253.217858] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156254.281185] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156254.281835] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156263.566025] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156263.568133] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156264.641301] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156264.642445] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156273.926165] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156273.927782] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
KERNEL[156274.981462] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
UDEV  [156274.982527] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)

are these sent even without touching monitors?
Comment 6 temptempor 2021-09-22 11:07:16 UTC
(In reply to Vlad Zahorodnii from comment #5)
> KERNEL[156222.155457] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156222.157532] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156223.210818] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156223.211969] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156232.505832] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156232.508054] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156233.570940] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156233.572104] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156242.845773] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156242.847666] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156243.911096] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156243.912215] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156253.215878] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156253.217858] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156254.281185] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156254.281835] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156263.566025] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156263.568133] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156264.641301] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156264.642445] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156273.926165] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156273.927782] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> KERNEL[156274.981462] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> UDEV  [156274.982527] change  
> /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/
> card0 (drm)
> 
> are these sent even without touching monitors?

Yes, I was not touching the monitors. They kind of fit the time frame and frequency of the kscreen events too.
Comment 7 Vlad Zahorodnii 2021-09-22 11:22:38 UTC
kscreen most likely reacts to udev change events (indirectly). If you disable kscreen (by killing kded5 or stopping it in "background services" in system settings), do "change" udev events stop coming in?
Comment 8 temptempor 2021-09-22 11:30:32 UTC
(In reply to Vlad Zahorodnii from comment #7)
> kscreen most likely reacts to udev change events (indirectly). If you
> disable kscreen (by killing kded5 or stopping it in "background services" in
> system settings), do "change" udev events stop coming in?

Just did that:

https://i.imgur.com/ETJCMmv.png

And the udevadm changes keep coming in:


>KERNEL[163490.114694] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163490.116428] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163491.179957] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163491.181127] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163500.474801] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163500.476476] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163501.530082] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163501.531276] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163510.834913] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163510.836465] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163511.890220] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163511.891143] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163521.185070] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163521.187010] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>KERNEL[163522.250357] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
>UDEV  [163522.251555] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
Comment 9 Vlad Zahorodnii 2021-09-22 13:32:18 UTC
Okay, that points to either drm driver or hardware. Just to be sure, can you run `sudo udevadm monitor -p`? It will print more detailed information about udev events.
Comment 11 Vlad Zahorodnii 2021-09-23 06:23:51 UTC
KERNEL[178429.918048] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
ACTION=change
DEVPATH=/devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0
SUBSYSTEM=drm
HOTPLUG=1
DEVNAME=/dev/dri/card0
DEVTYPE=drm_minor
SEQNUM=41763
MAJOR=226
MINOR=0
 
UDEV  [178429.920200] change   /devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0 (drm)
ACTION=change
DEVPATH=/devices/pci0000:00/0000:00:03.1/0000:26:00.0/0000:27:00.0/0000:28:00.0/drm/card0
SUBSYSTEM=drm
HOTPLUG=1
DEVNAME=/dev/dri/card0
DEVTYPE=drm_minor
SEQNUM=41763
USEC_INITIALIZED=82693860
ID_PATH=pci-0000:28:00.0
ID_PATH_TAG=pci-0000_28_00_0
ID_FOR_SEAT=drm-pci-0000_28_00_0
MAJOR=226
MINOR=0
DEVLINKS=/dev/dri/by-path/pci-0000:28:00.0-card
TAGS=:uaccess:seat:master-of-seat:
CURRENT_TAGS=:uaccess:seat:master-of-seat:

"HOTPLUG=1" we can't work around this. The kernel continuously sends kwin hotplug events, they can't be ignored otherwise new outputs won't be detected, etc. Please report this issue to kernel developers. It might be also a hardware issue, e.g. a loose connection or something like that.
Comment 12 temptempor 2021-09-24 20:04:30 UTC
For reference: 
https://gitlab.freedesktop.org/drm/amd/-/issues/1719

Can we still agree the behaviour on Wayland could be better though? 
Xorg session handles this quirk fine enough that it's unnoticeable unless I open the screen layout settings or look at my logs.