Bug 364709 - Activating desktop grid sometimes freezes X11
Summary: Activating desktop grid sometimes freezes X11
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-desktop-grid (show other bugs)
Version: 5.11.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Edmundson
URL:
Keywords:
: 395350 398474 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-24 14:19 UTC by Roland Leißa
Modified: 2018-11-03 20:08 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.15.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Leißa 2016-06-24 14:19:56 UTC
I have the effect "Desktop Grid" when putting the mouse cursor in the lower left screen edge. Sometimes, X11 will completely freeze. You can only move the mouse cursor. Nothing else works. Even switching to console with Ctrl+Alt+F2 and "killall kwin_x11" does not help.

Reproducible: Sometimes

Steps to Reproduce:
1. Activate "Desktop Grid"

As mentioned above, I have this behavior when triggering the effect with via the screen edge. I don't know, whether this also happens, when activating this effect via another way, e.g. key combo.



I'm using nvidia 367.27-1 with NVIDIA Corporation GK104 [GeForce GTX 670] (rev a1).
Comment 1 Thomas Lübking 2016-06-24 14:27:46 UTC
Is the process really gone?
Does your setup (present windows, panel showing) fit this:
   https://marc.info/?l=kwin&m=146606348925733&w=2
Comment 2 Roland Leißa 2016-06-27 12:21:40 UTC
I was just hit by the bug again. The reported issue seems to be my problem, too.

I double-checked the process list: kill -9 xxx helped. Then I went back to X11 via Ctrl+Alt+F1 and restarted kwin with Ctrl+Alt+F2: kwin_x11.
Comment 3 Thomas Lübking 2016-06-27 14:19:46 UTC
The reported issue is your if
a) you show panels in desktop grid + present windows
b) the panel strut hint is garbled (run "xprop _NET_WM_STRUT" and "xprop _NET_WM_STRUT_PARTIAL" and click the panel(s). if there's *any* number that exceeds your screen geometry, the hint is broken and you hit that issue and my estimation of the problem is right ;-)
Comment 4 Roland Leißa 2016-06-27 14:47:11 UTC
I do *not* show the panel in Desktop Grid by I *do* show present windows.
Comment 5 Roland Leißa 2016-07-11 12:17:38 UTC
Problem still persists in kwin 5.7.0.
Comment 6 Martin Flöser 2016-07-12 10:34:18 UTC
I'm not able to reproduce the problem. Could you please provide more information about the situation when you hit the condition? How many desktops, how many windows, what kind of windows are they? Where are they? Etc. Please provide as much information as needed to trigger the same condition.
Comment 7 Roland Leißa 2016-07-12 12:55:53 UTC
Number of Desktops: 6

I will give you more information as soon as I'm hit by this bug again.
Comment 8 Roland Leißa 2016-07-18 15:52:12 UTC
I was hit again:
Windows:
Desktop 1: Konsole + Okular
Desktop 2: empty
Desktop 3: Firefox
Desktop 4-5: empty
Desktop 6: Kontact.

All windows are maximized and I have two desktop rows. I triggered the freeze by putting the mouse cursor in the bottom left corner of Desktop 1.
Comment 9 Roland Leißa 2016-10-05 13:52:13 UTC
Seems to be fixed in 5.8.0. I'll reopen if I stumble upon this issue again.
Comment 10 Lukas Zavodny 2016-11-17 19:35:51 UTC
It happens to me almost every day on nVidia drivers nad kwin 5.8.3
9 desktops, 3 rows. Activation by left side of desktop. Only mouse is moving. Killing and starting kwin again helps with using computer without restart.
Comment 11 Wille 2016-12-30 18:05:35 UTC
This problem seems to still exist. For me, most of the times the desktop grid freezes (only mouse moving, but can still alt-ctrl-F1 etc) when accidentally moving a window, just a little nudge, inside desktop grid. If I'm extra careful not to move any windows inside Desktop Grid, it works nicely.
Comment 12 Roland Leißa 2017-11-21 15:34:37 UTC
This bug still exists. I'm pretty sure that there is some sort of race condition which will only trigger on older hardware. I will only encounter this bug on my old notebook - not on my workstation.
Comment 13 Roland Leißa 2017-11-21 15:35:29 UTC
Also, my work around posted in my first post doesn't work anymore which basically means that all your data is lost. That's why I changed to "critical".
Comment 14 Fabian Vogt 2018-05-18 09:35:30 UTC
AFAIK it's a bug in the "natural" distribution algorithm. It can go into an endless loop.

Workaround: Turn off present windows or switch the algorithm to one of the grid 
 based ones.
Comment 15 David Edmundson 2018-05-18 09:38:11 UTC
Can you share your ~/.config/kwinrc please
Comment 16 Martin Flöser 2018-06-14 14:58:20 UTC
*** Bug 395350 has been marked as a duplicate of this bug. ***
Comment 17 Vlad Zahorodnii 2018-10-20 15:40:53 UTC
Git commit 30ad58f559aa0cfc5dba649be387578481e8db32 by Vlad Zagorodniy, on behalf of Erik Kurzinger.
Committed on 20/10/2018 at 15:37.
Pushed by vladz into branch 'master'.

[effects/presentwindows] Avoid potential freeze during fill-gaps

Summary:
When using the natural layout algorithm with the fill-gaps option, a small
error (less than one) is introduced in windows' aspect ratio each time they are
enlarged due to floating-point roundoff.

Currently, the algorithm computes the width and height enlargement factors and
then attempts to enlarge in each of the four possible directions, repeating
until it can't enlarge any windows any further.  Hence, this aspect ratio error
can be multiplied by up to four. Especially for small, long, and narrow
windows, this can result in a total error of greater than one by the end of
that loop iteration. If this occurs, on subsequent iterations the height
enlargement factor might then be computed as negative violating some of the
core assumptions of the algorithm and resulting in the loop iterating endlessly
until one of the window dimensions overflows, freezing the program for up to
several minutes.

To fix this, the height enlargement factor should be re-computed based on the
new width each time the window is enlarged, ensuring the error introduced in
the aspect ratio never exceeds one.
Related: bug 380865, bug 368811

FIXED-IN: 5.15.0

Test Plan:
The most reliable way to reproduce the freeze seems to be to activate the
desktop-grid effect while a tool-tip window is fading in.
Ensure desktop-grid is configured to use present windows, and that present
windows is configured to use the natural layout algorithm with the fill gaps
option selected.

The freeze is still intermittent, but using this method should be able to be
triggered within about 10 tries without this fix.
After applying the fix, the freeze has never been observed.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: graesslin, kwin, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16278

M  +15   -3    effects/presentwindows/presentwindows.cpp

https://commits.kde.org/kwin/30ad58f559aa0cfc5dba649be387578481e8db32
Comment 18 Vlad Zahorodnii 2018-10-28 22:08:13 UTC
Git commit 4348cd56834cb17da5aa9d95d16ddc27bf39e0e6 by Vlad Zagorodniy, on behalf of Erik Kurzinger.
Committed on 28/10/2018 at 22:02.
Pushed by vladz into branch 'Plasma/5.12'.

[effects/presentwindows] Avoid potential freeze during fill-gaps

Summary:
When using the natural layout algorithm with the fill-gaps option, a small
error (less than one) is introduced in windows' aspect ratio each time they are
enlarged due to floating-point roundoff.

Currently, the algorithm computes the width and height enlargement factors and
then attempts to enlarge in each of the four possible directions, repeating
until it can't enlarge any windows any further.  Hence, this aspect ratio error
can be multiplied by up to four. Especially for small, long, and narrow
windows, this can result in a total error of greater than one by the end of
that loop iteration. If this occurs, on subsequent iterations the height
enlargement factor might then be computed as negative violating some of the
core assumptions of the algorithm and resulting in the loop iterating endlessly
until one of the window dimensions overflows, freezing the program for up to
several minutes.

To fix this, the height enlargement factor should be re-computed based on the
new width each time the window is enlarged, ensuring the error introduced in
the aspect ratio never exceeds one.
Related: bug 380865, bug 368811

FIXED-IN: 5.15.0

Test Plan:
The most reliable way to reproduce the freeze seems to be to activate the
desktop-grid effect while a tool-tip window is fading in.
Ensure desktop-grid is configured to use present windows, and that present
windows is configured to use the natural layout algorithm with the fill gaps
option selected.

The freeze is still intermittent, but using this method should be able to be
triggered within about 10 tries without this fix.
After applying the fix, the freeze has never been observed.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: graesslin, kwin, zzag

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16278

M  +15   -3    effects/presentwindows/presentwindows.cpp

https://commits.kde.org/kwin/4348cd56834cb17da5aa9d95d16ddc27bf39e0e6
Comment 19 Vlad Zahorodnii 2018-11-03 20:08:22 UTC
*** Bug 398474 has been marked as a duplicate of this bug. ***