Bug 484495

Summary: Wayland native apps close often when the computer is slower due to high i/o
Product: [Plasma] kwin Reporter: Patrick Silva <bugseforuns>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: fanzhuyifan, me, voidpointertonull+bugskdeorg
Priority: NOR Keywords: qt6
Version: 6.0.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://gitlab.freedesktop.org/wayland/wayland/-/issues/159
See Also: https://bugs.kde.org/show_bug.cgi?id=392376
Latest Commit: Version Fixed In:

Description Patrick Silva 2024-03-25 22:58:06 UTC
SUMMARY
Frequently my system becomes slower and barely usable when I move high amount of files from Home to another partition. In this scenario, Wayland native apps (Thunderbird and Vivaldi browser, for example) close often due to some problem related to kwin_wayland.

In the Thunderbird case, I see these messages in the journal log:
mar 25 19:45:41 Arch-PC kwin_wayland_wrapper[926]: error in client communication (pid 157108)
mar 25 19:45:41 Arch-PC plasmashell[157196]: Exiting due to channel error.
mar 25 19:45:41 Arch-PC systemd[829]: app-Thunderbird-885d9fdab9994f129540a48f61d43c26.scope: Consumed 9.291s CPU time.

STEPS TO REPRODUCE
1. cause high i/o while using Wayland session
2. try to use Wayland native apps normally during high i/o
3. 

OBSERVED RESULT
Wayland native apps close often

EXPECTED RESULT
the observed result should not occur

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Graphics Platform: Wayland
Comment 1 Patrick Silva 2024-03-25 23:07:40 UTC
It happened again:

mar 25 20:06:56 Arch-PC kwin_wayland_wrapper[926]: error in client communication (pid 158020)
mar 25 20:06:56 Arch-PC thunderbird[158020]: Lost connection to Wayland compositor.
mar 25 20:06:56 Arch-PC plasmashell[158106]: Exiting due to channel error.
mar 25 20:06:56 Arch-PC systemd[829]: app-Thunderbird-57cdae19694241bbb1fb043f5c46afa2.scope: Consumed 22.272s CPU time.
Comment 2 fanzhuyifan 2024-03-26 01:17:12 UTC
I would say this is upstream wayland issue: https://gitlab.freedesktop.org/wayland/wayland/-/issues/159
Comment 3 Pedro V 2024-04-29 14:49:13 UTC
The Wayland-specific part is already covered by #392376 .

The issue with background I/O being capable of slowing everything down to almost a halt is a Linux kernel problem with a long history, and it doesn't look like it's getting improvements any soon, but you can surely make it worse by using extra features added over time like Btrfs with really heavy compression.
KDE overall is getting quite resilient to it, at least as long as the I/O queue is progressing, not a complete halt as an NFS mount not responding will unfortunately still get many KDE components unusable as there's a whole lot of mount point poking everywhere with questionable necessity.

Apparently I can't set CLOSED, so setting DUPLICATE while keeping the RESOLVED status, even though the issue itself isn't resolved.

*** This bug has been marked as a duplicate of bug 392376 ***
Comment 4 Marco Rebhan 2024-04-29 16:01:08 UTC
(In reply to Pedro V from comment #3)
> The issue with background I/O being capable of slowing everything down to
> almost a halt is a Linux kernel problem with a long history, and it doesn't
> look like it's getting improvements any soon, but you can surely make it
> worse by using extra features added over time like Btrfs with really heavy
> compression.

I don't think this is really something that can be fixed on the Linux kernel side and is a problem on any OS in some form (though other OSes don't have such a disastrous reaction to it). This is caused by the wayland server killing the socket connection to clients whose event buffer fills up, very often caused by the application doing blocking I/O or other long operations on the UI thread, but could also happen when the system is generally overloaded and the client process doesn't get scheduled in time to empty its event buffer. It has to be fixed in the wayland protocol lib (to handle a full socket buffer more gracefully) and also in applications (don't block the UI thread).