Bug 488476 - Lingering scene/workspacescene issue resulting in system freeze?
Summary: Lingering scene/workspacescene issue resulting in system freeze?
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.0.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-14 00:43 UTC by Nick
Modified: 2024-07-02 00:29 UTC (History)
2 users (show)

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


Attachments
mangohud showing FPS 0/frametime inf on focus switch (254.26 KB, video/webm)
2024-06-14 00:43 UTC, Nick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2024-06-14 00:43:00 UTC
Created attachment 170488 [details]
mangohud showing FPS 0/frametime inf on focus switch

SUMMARY
When a borderless windowed/fullscreen game (noticed with Proton, but a native Unity game shows the symptom) switches focus, kwin apparently has a chance to hard freeze the system when the window switches focus. Wayland session.
Mangohud might matter? Not sure as the freeze is too inconsistent.

STEPS TO REPRODUCE
1. Run game in borderless windowed/fullscreen.
2. Press meta key to open and close application launcher or alt+tab out and back repeatedly.

OBSERVED RESULT
If mangohud is enabled, FPS drops to 0 with inf frametime for a second as the window switches focus. An example is attached. The system may freeze during this.

EXPECTED RESULT
The system doesn't freeze, and mangohud doesn't do that.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: CachyOS
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION
When kwin 6.0.4 released, this bug was introduced: https://bugs.kde.org/show_bug.cgi?id=485730
On that release borderless windowed/fullscreen games had a constant stutter and mangohud was flickering badly. Then would eventually have a system freeze.

That was fixed in 6.0.4.1 with: https://invent.kde.org/plasma/kwin/-/merge_requests/5626
But that still left that hiccup visible with mangohud, which didn't exist on kwin 6.0.3.1. From kwin 6.0.4.1 to 6.0.5 I didn't have any system freezes when alt tabbing from borderless windowed/fullscreen games until today.
After it happened through normal use, I tried to cause it on purpose by spamming the application menu with the meta key and the system froze after about 10 seconds. However one more try after that didn't freeze after about a minute. Mangohud on all three times.
Like with the system freezes I had on kwin 6.0.4, the journal stops writing once it happens and I can't switch TTY.
Also, mangohud doesn't drop when the window switches focus on an X11 session.

If kwin is downgraded to 6.0.3.1, mangohud still doesn't drop when the window switches focus on Wayland.
Comment 1 Zamundaaa 2024-06-15 13:07:40 UTC
Can you still ssh into the system when it's frozen?
Comment 2 Nick 2024-06-16 09:06:46 UTC
After it freezes, trying to ssh from another PC takes a while before returning "No route to host." Connects as expected when not frozen.

While trying to get a freeze, I first tried without mangohud. Couldn't get it to happen after 10 minutes of hitting the meta key and alt tabbing.
As soon as I tried again with mangohud it happened within a minute. The frame it froze on had mangohud not visible mid flicker.

I remembered I have been using gamescope to work around annoying windowing behaviors with the games I'd been playing recently.
Mangohud doesn't have that FPS 0/frametime inf and flicker with it. To be expected I suppose as it's a separate WM/compositor?
And why I ran into this as I got back to a different game I wasn't using gamescope for.
Comment 3 Bug Janitor Service 2024-07-01 03:47:17 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Zamundaaa 2024-07-01 14:34:26 UTC
If you can't SSH in, the problem is in the kernel. Please report this to https://gitlab.freedesktop.org/drm/amd/-/issues/
Comment 5 Nick 2024-07-01 23:46:57 UTC
Even if mangohud didn't have that flicker with the FPS 0/inf frametime drop when kwin was downgraded to 6.0.3.1?
Unfortunately trying to downgrade below kwin 6.1.1 now results in being unable to start a session, and I hadn't tried to force a freeze when I was able to do so.

Some additional things:
1. I checked the x11 session and mangohud behaved like on the wayland session, so I suppose the component should be "general."
2. While experimenting with various games, I found that after launching a fullscreened Unity game (through wine, and several worked) with mangohud multiple times, eventually mangohud stops doing those things when the window loses and regains focus. This then applies to any further launched fullscreen application with mangohud enabled. I have no idea why this happens.
3. With mangohud doing those things, I can't seem to force a freeze now on kwin 6.1.1 and 6.1.1.2. After I opened this issue I was using gamescope when possible to avoid freezing. If it does happen again, I will open an issue there.
Comment 6 Zamundaaa 2024-07-02 00:29:47 UTC
Yes. KWin doing direct scanout (which didn't properly work before 6.0.4) triggers the bug somehow, but a system wide freeze is always ultimately a kernel bug.