Bug 450940 - [Wayland] Desktop freezes when Zoom effect is enabled
Summary: [Wayland] Desktop freezes when Zoom effect is enabled
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (other bugs)
Version First Reported In: 5.24.2
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland-only
: 462346 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-02-27 22:16 UTC by Iván Ávalos
Modified: 2023-12-08 20:25 UTC (History)
3 users (show)

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


Attachments
gdb backtrace (2.67 KB, text/plain)
2022-03-01 03:21 UTC, Iván Ávalos
Details
gdb backtrace w/debug symbols (13.26 KB, text/plain)
2022-03-06 07:18 UTC, Iván Ávalos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iván Ávalos 2022-02-27 22:16:05 UTC
SUMMARY
Recently, I have experienced desktop freezes in the Wayland session, where after doing certain specific things in GTK+ apps, the whole desktop freezes for some minutes, and then unfreezes, and then freezes again. During the freezes, I'm unable to use the keyboard (no switch to different TTY, no volume up/down, no Ctrl+Alt+Del, etc.), but even with the display frozen, I'm still able to control the system remotely (e.g. KDE Connect) and music still plays.

I really did an effort to figure out what was causing the issue, and came to the conclusion that it is definitely Plasma. At first, I thought it had something to do with webkit2gtk, because Tangram was causing the freezes. Then I discovered Gajim and Claws Mail also caused them. Then, I thought it was related to Wayland, so I tried doing the same things in X11, and no freezes! It had to be Wayland! Finally, I tried using Enlightenment and Weston under Wayland, and no freezes! It must be KDE!


STEPS TO REPRODUCE
1. Open Tangram.
2. Wait for Pinafore to load the posts.
3. Before it loads the posts, freeze!
4. After some minutes, unfreeze!

1. Open Tangram.
2. Wait for WhatsApp to load.
3. Switch to a different chat, freeze!
4. After some minutes, unfreeze!
5. Go to 3.

1. Open GNOME Web.
2. Do random stuff.
3. Sometimes, out of nowhere, freeze!
4. After some minutes, unfreeze!
5. Go to 2.

1. Open Gajim.
2. Open a chat window.
3. Write in the message box.
4. After some characters, freeze!
5. After some minutes, unfreeze!
6. Go to 4.

(It has stopped happening.)
1. Open Claws Mail.
2. Do random stuff in the second account from top to bottom.
3. Click a mailbox (e.g. Inbox) in the first account from top to bottom.
4. Freeze!

OBSERVED RESULT
The entire desktop freezes.

EXPECTED RESULT
No freezes!

SOFTWARE/OS VERSIONS
Operating System: Parabola
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.15.12-gnu-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

ADDITIONAL INFORMATION
The freezes are not related to memory or CPU. The same will happen either right after booting my system or with tons of apps (including Android Studio) open. No significant memory or CPU overhead seem to be present.
Comment 1 Iván Ávalos 2022-02-27 22:20:03 UTC
ADDITIONAL INFORMATION
No suspicious dmesg or journalctl logs are present whatsoever.
Comment 2 Iván Ávalos 2022-02-27 22:36:46 UTC
ADDITIONAL INFORMATION
No Qt apps seem to cause the freezes, that's why this bug's title contains “GTK+”.
Comment 3 Iván Ávalos 2022-02-28 03:08:06 UTC
ADDITIONAL INFORMATION
The duration of each freeze ranges from 50 seconds to 1:30 minutes.
Comment 4 David Edmundson 2022-02-28 11:32:40 UTC
Cannot immediately reproduce, and we'll need more information to be able to do anything.

25seconds implies a blocking DBus call.

Can you reproduce whilst running in a nested session? 

export `dbus-launch `
kwin_wayland --socket test
WAYLAND_DISPLAY=test tangram


Failing that we'll need you to ssh into the machine whilst frozen from another computer / phone and get a backtrace
Comment 5 Iván Ávalos 2022-02-28 15:54:25 UTC
I get this interesting log in Gajim, not sure if it's related to the freezes, but at least I can reproduce them:

28/02/22 09:37:14 (W) gajim.c.idle               org.freedesktop.ScreenSaver.GetSessionIdleTime() failed: g-io-error-quark: Timeout was reached (24)
28/02/22 09:37:39 (W) gajim.c.idle               org.freedesktop.ScreenSaver.GetSessionIdleTime() failed: g-io-error-quark: Timeout was reached (24)

What is interesting is that I could not reproduce with Tangram, and Gajim froze not only the nested session, but also the parent session.
Comment 6 Iván Ávalos 2022-02-28 16:17:44 UTC
I have a question: is it possible to get a backtrace even if the process doesn't crash?
Comment 7 Iván Ávalos 2022-03-01 03:21:53 UTC
Created attachment 147205 [details]
gdb backtrace

I managed to obtain a backtrace via SSH, although I'm not sure if I did it correctly, or if you need debug symbols. I followed the steps in https://community.kde.org/Plasma/Debugging#Attach_gdb_to_the_plasmashell_process

The steps I used to obtain the backtrace were the following:
1. Login via SSH.
2. $ gdb -p $(pidof kwin_wayland)
(gdb) set logging file kwinwayland2.txt
(gdb) set logging on
(gdb) continue
[[Open Gajim and write in the message box… freeze!]]
^C
(gdb) thread apply all backtrace
(gdb) quit
Comment 8 Iván Ávalos 2022-03-06 07:18:47 UTC
Created attachment 147316 [details]
gdb backtrace w/debug symbols

Here's an awesome and a lot more detailed backtrace with debug symbols and stuff. Based on Thread 2 backtrace, it seems like it is a DBus block, indeed.
Comment 9 Iván Ávalos 2022-03-06 07:23:16 UTC
Got it, got it, got it! Thread 1 backtrace (#9) references KWin::ZoomAccessibilityIntegration, which means that the Zoom effect in Desktop Effects might have something to do, so I disabled the Zoom effect and voilà! Freezes are magically gone!
Comment 10 Nate Graham 2022-03-22 03:32:07 UTC
Zoom effects works for me on Wayland FWIW.
Comment 11 Iván Ávalos 2022-03-22 03:50:31 UTC
(In reply to Nate Graham from comment #10)
> Zoom effects works for me on Wayland FWIW.

It works for me too, but it causes the freezes described in this ticket when doing certain things on certain GTK+ apps, because of some broken accessibility API that causes D-Bus blocks in Kwin.
Comment 12 Bug Janitor Service 2023-12-08 16:57:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4773
Comment 13 Zamundaaa 2023-12-08 19:39:15 UTC
Git commit 5734342f9f96291941a4d5d1fdce4f9d608a3117 by Xaver Hugl.
Committed on 08/12/2023 at 20:27.
Pushed by zamundaaa into branch 'master'.

plugins/zoom: disable acessibility integration on Wayland

It causes hangs, and thus doesn't actually help with accessibility but makes
it worse. Until that's fixed, it needs to stay disabled

M  +13   -8    src/plugins/zoom/zoom.cpp

https://invent.kde.org/plasma/kwin/-/commit/5734342f9f96291941a4d5d1fdce4f9d608a3117
Comment 14 Nicolas Fella 2023-12-08 20:25:09 UTC
*** Bug 462346 has been marked as a duplicate of this bug. ***