Bug 438990

Summary: Better detection of unresponsive applications
Product: [Plasma] kwin Reporter: Yevhen Popok <xalt7x.service>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: alois1, nate, xaver.hugl
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Demonstation how frozen application reuses screen content and how KWin reacts to frozen applications

Description Yevhen Popok 2021-06-21 12:32:52 UTC
Created attachment 139571 [details]
Demonstation how frozen application reuses screen content and how KWin reacts to frozen applications

SUMMARY
There is a usability problem with unresponsive/hanged/frozen applications. When application window stops responding, it may "take" part of the screen (user may see not application content before hang but content of the desktop or previous window). That's especially confusing for maximized windows. So we should try to close that window with a button on a window decoration or on the panel. Then it may apply effect "Desaturate Unresponsive Applications" for a frozen window and finally show a dialog that process is not responding.
I see 2 problems here:
1. Dialog is only triggered with a "close" action
2. As frozen window reuses some screen content, for a user sometimes very hard to find that window on a screen. User must rely on a panel (Task Manager), Task Switcher, "Present Windows" etc. Situation gets worse with CSD and variable "KWIN_EFFECTS_FORCE_ANIMATIONS=0" which among others disables effect "Desaturate Unresponsive Applications".
I tried to boot into GNOME 3.36 and liked how Mutter deals with this issue:
- it detects that application is frozen without user's specific interaction with a close button/command and shows dialog with 
- It dims window and repeats showing that dialog if user selected to "Wait Longer". Also as Mutter attaches that modal dialog to a parent window, for a user it's really easy to identify frozen window. 

STEPS TO REPRODUCE
1. Launch Kate and maximize it's window
2. Launch Konsole and maximize it's window
3. On a Konsole find PID for a "Kate" process with
ps -ely | grep kate
(3rd collumn)
4. Simulate process hang with a command
kill -SIGSTOP <PID>
5. Minimize Kate (left click on a Kate item on a Task Manager on the panel) so you will see Konsole window
6. Unminize Kate

OBSERVED RESULT
- KWin doesn't detect that application is unresponsive unless you press a "close" button
- Unresponsive application reuses screen content so it's hard to identify your frozen window, especially with programs which use CSD (e.g "Gedit)

EXPECTED RESULT
User can easily identify and close unresponsive program

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.22 User Edition
KDE Plasma Version: 5.22.1
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
Video demonstration attached
Comment 1 Alois Wohlschlager 2021-06-23 14:15:02 UTC
While I agree that the current behavior is not ideal, I cannot reproduce the bug entirely with your steps. What happens in my case is the following:

* Screen content is not reused, the Kate window displays like it did the last time before the SIGSTOP.
* The desaturation is applied after a couple of seconds even without any interaction with the Kate window (apart from minimizing and unminimizing).
* The dialog does not show up at all, instead the window closes after some seconds while leaving the stopped kate process hanging around.
Comment 2 Yevhen Popok 2021-06-28 09:03:54 UTC
@(In reply to Alois Wohlschlager from comment #1)
> While I agree that the current behavior is not ideal, I cannot reproduce the
> bug entirely with your steps.
Can you please provide your system information (Distro, video card, Plasma version, KWin version (KWin or KWinFT), Session type (X11, Wayland)?
> * Screen content is not reused, the Kate window displays like it did the
> last time before the SIGSTOP.
In my case initially screen content of previous windows is not reused. It happens if I minimize/unminimize "frozen" application (e.g. Kate, GNOME Disks). Also screen content is reused even after de-saturation effect is applied.
Comment 3 Alois Wohlschlager 2021-06-29 13:07:14 UTC
I'm on openSUSE Tumbleweed 20210623 with Plasma 5.22.1 and standard KWin. I'm running a Wayland session on an Intel GPU.

Screen content was never reused with my setup. I now retried with Xorg and can reproduce the reuse of screen content there.
Comment 4 Zamundaaa 2024-04-25 14:14:36 UTC
This is implemented on Wayland, just focusing the window is enough to mark it as not responding