Bug 460971 - Desktop freeze when changing between virtual desktops using screen edge dragging while compositing is on
Summary: Desktop freeze when changing between virtual desktops using screen edge dragg...
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 5.26.1
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-10-25 07:33 UTC by kdebuggy
Modified: 2022-12-21 16:37 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kdebuggy 2022-10-25 07:33:39 UTC
SUMMARY
Context:
- Problem started after upgrading to Kubuntu 22.10 with KDE 5.26.1
- I am using "Switch desktop on screen edges" to switch between virtual desktops seamlessly
- Problem occurs randomly, I couldn't detect a pattern yet

Clues:
When system is working:
- After the update switching to other desktop sometimes stops. Mouse is stuck at the edge of screen instead of continuing to the next virtual desktop. To fix this, I have to first go to the opposite virtual desktop. Then it gets unstuck. This never happened before the update.
- Freezing is not time dependent. System is stable as long as mouse is not used.
- Freezing is not load dependent. I can play 3D games without freezing.

When system is frozen:
- Cursor can be moved but can not click on anything
- System is operating normally in the background when freeze occurs (encoding jobs, downloads continue as usual)
- I can CTRL+ALT+F2 to a terminal (but only once) and run commands including rebooting the computer

Things I tried without an effect:
- Disabling the Compositor
- Disabling hardware acceleration in Firefox

STEPS TO REPRODUCE
1. Switching between virtual desktops with mouse with the following settings- 
"Switch desktop on screen edges" - ENABLED
"Activation delay" - DISABLED
"Reactivation delay" - 1000 ms

OBSERVED RESULT
At some random point you are stuck in the current desktop with GUI frozen as described above

EXPECTED RESULT
System switches to the next desktop when mouse cursor passes the boundary

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 22.10
KDE Plasma Version: 5.26.1
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 5.19.0-23-generic (64-bit)

Graphics Platform: X11
AMD Radeon RX 6600
Mesa 22.2.1
Comment 1 Nate Graham 2022-10-25 17:14:44 UTC
Are you using the Klassy window decoration theme?
Comment 2 kdebuggy 2022-10-25 18:04:08 UTC
Nope, just the default global Breeze dark theme.

But I noticed something different that might be a clue.
My screen started occasionally flickering very fast and for a very short time (like 3 times in 100 ms).
It almost feels like KWin restarting but much much faster.

I was using the same video card and Mesa driver version before the update.
So only variable that changed in my system is the last KDE update to 5.26.1.
My previous version was 5.25.5 so culprit might be a change between this versions.

As an experiment I disabled "screen edge desktop switching with mouse" and computer didn't freeze today.
But I need more data points of course.

(By the way, I like pointieststick and thank you for all your contributions Nate. And congratulations for the new position :)
Comment 3 Nate Graham 2022-10-25 18:34:39 UTC
Thank you so much for the info and the kind words!
Comment 4 Nate Graham 2022-10-26 17:51:23 UTC

*** This bug has been marked as a duplicate of bug 460932 ***
Comment 5 kdebuggy 2022-10-26 21:01:34 UTC
Based on that video, I can say that bug looks different from mine.
His window components like tabs, applications menu, buttons still react to his cursor.
In my case, whole desktop becomes a picture basically.
It becomes impossible for me to click on anything let alone open the applications menu.

Is there any log that I can keep an eye on to catch something when it happens ?
I currently have journalctl/syslog realtime open on my workspace which provide me logs for plasmashell/kwin_x11/kded5, is this enough ?
Comment 6 kdebuggy 2022-10-29 00:23:47 UTC
UPDATE:
- I ENABLED "screen edge desktop switching with mouse" back again
- But DISABLED Compositing
- And RESTARTED the computer after disabling Compositing

RESULT:
No freezing for 2 days.
So the problem might be Compositor interaction with the "screen edge desktop switching".
I guess problem can be narrowed to "Compositor changes after 5.25.5".
Comment 7 Anders Wenhaug 2022-11-07 22:53:09 UTC
I am also seeing this same issue since about 10 days ago or so. However I do not use the mouse for switching between virtual desktops, I am using keyboard shortcuts (i.e. ctrl+alt+arrows). For me the screen freezes in the middle of a transition between virtual desktops, but I can still move the cursor around. The cursor also seems to react as it normally would (changing to a "resize" cursor when on the edge of a window), but it does not necessarily match what I see on the screen. It seems like the windows are considered to be where they would be in a finished transition, so that the cursor reacts to where they would be, only that the render is not updated.

I can also switch to another TTY, and everything is as it should. Cannot find any logs at all in journalctl or dmesg.

One thing I noticed: After attempting alt+f2 I was no longer able to switch TTYs, and had to do a hard reboot.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7
Kernel Version: 6.0.7-arch1-1 (64-bit)

Graphics Platform: X11
AMD Radeon RX 6800XT
Mesa 22.2.2-1
Comment 8 Anders Wenhaug 2022-11-07 23:04:05 UTC
After some digging it seems that upgrading from 5.25.5 -> 5.26.1 introduced the issue for me as well.
Comment 9 Anders Wenhaug 2022-11-09 18:01:11 UTC
It happened again today, but this time I noticed before the freeze that when I opened a new Konsole window the window was fully black (except for the window decoration which I'm pretty sure was present). This happened for every new Konsole window I opened (did not test with other applications). The very next time I changed virtual desktops I got the freeze.

I have seen the black Konsole window directly before the freeze previously as well.
Comment 10 kdebuggy 2022-11-26 16:15:04 UTC
An UPDATE AND RESOLUTION for this bug:
After encountering other bugs too (flickering, Plasma shell dying in a responsive state) I started to suspect that my Plasma configuration which I was keeping for a long time might be the culprit.

After searching how to do it, I basically resetted my home folder to a new installation default state.
I did this by renaming .kde / .config / .cache directories from a live kubuntu usb to force the system to create clean ones.
(I later moved the old config files/directories to the new one except kde/plasma related ones of course)
I can say that all my problems are solved (testing for 2 days so far) and KDE is working perfectly with the compositor turned on.

SUMMARY: Probably 5.26.1 update didn't cause a direct problem by itself but triggered some instability caused by some very old config option/file interaction.

META COMMENT: After this experience I tought about how many KDE bugs people talking about can be resolved by this action.
Maybe it is a good idea to add some feature to reset KDE into fresh installation state like Firefox is doing with its "Refresh Firefox" feature.
Currently I had to search the net to determine the configuration files/folders and I compared them with a fresh test user I created for this purpose. Also I had to do this from a live linux usb. This is beyond an average user's skill set and an option to quickly return the plasma to a known state might be very helpful when dealing with mysterious bugs.

This is a preliminary comment and I will update after some more usage to be sure. 
I encourage other users suffering from this bug to try the cleaning method and confirm my results.
Comment 11 Nate Graham 2022-11-29 18:26:11 UTC
It's not a bad idea, yeah. Thanks for following up!
Comment 12 kdebuggy 2022-12-08 13:03:52 UTC
FINAL UPDATE:
2 weeks of regular usage after the mentioned cleanup and I didn't have any crashes.
Also cleanup solved some other problems like stuck desktop zoom, slow shutdown, disappearing window decorations etc.
Thanks Nate and have a nice day !
Comment 13 Nate Graham 2022-12-09 01:11:41 UTC
Thanks, you too! Glad it's working better now.
Comment 14 Anders Wenhaug 2022-12-21 16:37:41 UTC
Thanks a lot for reporting your findings back, kdebuggy, your workaround has worked flawlessly for me as well for the last two weeks!