Bug 368811 - Screen freezed when trying to get desktop grid from desktop corner (3d effect)
Summary: Screen freezed when trying to get desktop grid from desktop corner (3d effect)
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-desktop-grid (show other bugs)
Version: 5.7.3
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: drkonqi
: 375268 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-14 15:41 UTC by Christophe Larsonneur
Modified: 2018-10-28 22:08 UTC (History)
6 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 Christophe Larsonneur 2016-09-14 15:41:32 UTC
Application: kwin_x11 (5.7.3)

Qt Version: 5.6.1
Frameworks Version: 5.25.0
Operating System: Linux 4.7.2-101.fc23.x86_64 x86_64
Distribution: "Fedora release 23 (Twenty Three)"

-- Information about the crash:
- What I was doing when the application crashed:
I was moving my mouse to the top screen to show all desktop in grid mode (3d effect I activated)


- Unusual behavior I noticed:
The 3d effect does not occur to show desktop grid and the screen stay freezed.
My mouse is still moving around the screen and I can do a Ctrl-Alt-F2 to see on tty what is wrong.
The kwin process is then consuming 100% CPU and at some time, that can be really long, crashed.

Frequency:
It is quite frequent but it not always.

To workaround this issue:
I move to a tty (Ctrl-Alt-F2 for example)
then I start a new DISPLAY=:0 kwin --replace & and the desktop restart to work properly.
Sometimes, I need to re-activate the desktop 3d feature. (Shift-Ctrl-F12 twice)
At this point everything is back working.

The freezed kwin process is still there, running and I let it like this. And some point, this process, randomly timed, crashed.

I'm using the nvidia driver (not nouveau)

$ rpm -qa *nvidia*
kmod-nvidia-4.6.6-200.fc23.x86_64-367.44-1.fc23.x86_64
kmod-nvidia-4.7.2-101.fc23.x86_64-367.44-1.fc23.x86_64
xorg-x11-drv-nvidia-kmodsrc-367.44-1.fc23.x86_64
akmod-nvidia-367.44-1.fc23.x86_64
xorg-x11-drv-nvidia-367.44-1.fc23.x86_64
kmod-nvidia-4.6.4-201.fc23.x86_64-367.44-1.fc23.x86_64
xorg-x11-drv-nvidia-libs-367.44-1.fc23.x86_64

The crash can be reproduced sometimes.

-- Backtrace:
Application: KWin (kwin_x11), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f6eb9cb1940 (LWP 734))]

Thread 5 (Thread 0x7f6eb144c700 (LWP 768)):
#0  0x00007f6ecafe3903 in select () from /lib64/libc.so.6
#1  0x00007f6ecbdd303f in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /lib64/libQt5Core.so.5
#2  0x00007f6ecbdd46ee in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) () from /lib64/libQt5Core.so.5
#3  0x00007f6ecbdd4c02 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#4  0x00007f6ecbd8725a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#5  0x00007f6ecbbe7bd4 in QThread::exec() () from /lib64/libQt5Core.so.5
#6  0x00007f6ecd963675 in QDBusConnectionManager::run() () from /lib64/libQt5DBus.so.5
#7  0x00007f6ecbbec00c in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#8  0x00007f6ecde5f61a in start_thread () from /lib64/libpthread.so.0
#9  0x00007f6ecafed5fd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f6ea3de1700 (LWP 827)):
#0  0x00007f6ecafe3903 in select () from /lib64/libc.so.6
#1  0x00007f6ecbdd303f in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /lib64/libQt5Core.so.5
#2  0x00007f6ecbdd46ee in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) () from /lib64/libQt5Core.so.5
#3  0x00007f6ecbdd4c02 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#4  0x00007f6ecbd8725a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#5  0x00007f6ecbbe7bd4 in QThread::exec() () from /lib64/libQt5Core.so.5
#6  0x00007f6ed2b087f5 in QQmlThreadPrivate::run() () from /lib64/libQt5Qml.so.5
#7  0x00007f6ecbbec00c in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#8  0x00007f6ecde5f61a in start_thread () from /lib64/libpthread.so.0
#9  0x00007f6ecafed5fd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f6e9bfff700 (LWP 829)):
#0  0x00007f6ecde64b20 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f6ed38b22e4 in QTWTF::TCMalloc_PageHeap::scavengerThread() () from /lib64/libQt5Script.so.5
#2  0x00007f6ed38b2329 in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /lib64/libQt5Script.so.5
#3  0x00007f6ecde5f61a in start_thread () from /lib64/libpthread.so.0
#4  0x00007f6ecafed5fd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f6eb1e94700 (LWP 17940)):
#0  0x00007f6ecafe3903 in select () from /lib64/libc.so.6
#1  0x00007f6ecbdd303f in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /lib64/libQt5Core.so.5
#2  0x00007f6ecbdd46ee in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) () from /lib64/libQt5Core.so.5
#3  0x00007f6ecbdd4c02 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#4  0x00007f6ecbd8725a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#5  0x00007f6ecbbe7bd4 in QThread::exec() () from /lib64/libQt5Core.so.5
#6  0x00007f6ed2b087f5 in QQmlThreadPrivate::run() () from /lib64/libQt5Qml.so.5
#7  0x00007f6ecbbec00c in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5
#8  0x00007f6ecde5f61a in start_thread () from /lib64/libpthread.so.0
#9  0x00007f6ecafed5fd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f6eb9cb1940 (LWP 734)):
[KCrash Handler]
#6  0x00007f6ecc1300a3 in QIcon::~QIcon() () from /lib64/libQt5Gui.so.5
#7  0x00007f6ecc13d758 in ScalableEntry::~ScalableEntry() () from /lib64/libQt5Gui.so.5
#8  0x00007f6ecc1370fe in QIconLoaderEngine::~QIconLoaderEngine() () from /lib64/libQt5Gui.so.5
#9  0x00007f6ecc137199 in QIconLoaderEngine::~QIconLoaderEngine() () from /lib64/libQt5Gui.so.5
#10 0x00007f6ecc1300a6 in QIcon::~QIcon() () from /lib64/libQt5Gui.so.5
#11 0x00007f6ecc1300e9 in (anonymous namespace)::Q_QGS_qtIconCache::innerFunction()::Holder::~Holder() () from /lib64/libQt5Gui.so.5
#12 0x00007f6ecaf245e8 in __run_exit_handlers () from /lib64/libc.so.6
#13 0x00007f6ecaf24635 in exit () from /lib64/libc.so.6
#14 0x00007f6ed04c8215 in _XDefaultIOError () from /lib64/libX11.so.6
#15 0x00007f6eb2b6790e in ioErrorHandler(_XDisplay*) () from /lib64/libQt5XcbQpa.so.5
#16 0x00007f6ed04c843e in _XIOError () from /lib64/libX11.so.6
#17 0x00007f6ed04c5702 in require_socket () from /lib64/libX11.so.6
#18 0x00007f6ed04c5f39 in _XFlush () from /lib64/libX11.so.6
#19 0x00007f6ed04c8ac5 in _XGetRequest () from /lib64/libX11.so.6
#20 0x00007f6ed04a3bfa in XCreateColormap () from /lib64/libX11.so.6
#21 0x00007f6eb2b86671 in QXcbWindow::create() () from /lib64/libQt5XcbQpa.so.5
#22 0x00007f6eb2b71e31 in QXcbIntegration::createPlatformWindow(QWindow*) const () from /lib64/libQt5XcbQpa.so.5
#23 0x00007f6ecc0cb6ed in QWindowPrivate::create(bool) () from /lib64/libQt5Gui.so.5
#24 0x00007f6ecc0cbe98 in QWindow::setVisible(bool) () from /lib64/libQt5Gui.so.5
#25 0x00007f6ed3a08642 in KWin::DesktopGridEffect::setup() () from /lib64/libkwin4_effect_builtins.so.1
#26 0x00007f6ed3a08a92 in KWin::DesktopGridEffect::setActive(bool) () from /lib64/libkwin4_effect_builtins.so.1
#27 0x00007f6ed3a08e69 in KWin::DesktopGridEffect::borderActivated(KWin::ElectricBorder) () from /lib64/libkwin4_effect_builtins.so.1
#28 0x00007f6ed3ede623 in KWin::Effect::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.0] () from /lib64/libkwineffects.so.8
#29 0x00007f6ecbd930b6 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /lib64/libQt5Core.so.5
#30 0x00007f6ecbd976e1 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /lib64/libQt5Core.so.5
#31 0x00007f6ed4296ea3 in KWin::Edge::handleByCallback() () from /lib64/libkwin.so.5
#32 0x00007f6ed4298470 in KWin::Edge::handle(QPoint const&) () from /lib64/libkwin.so.5
#33 0x00007f6ed4298529 in KWin::Edge::check(QPoint const&, QDateTime const&, bool) () from /lib64/libkwin.so.5
#34 0x00007f6ed4298d55 in KWin::ScreenEdges::handleEnterNotifiy(unsigned int, QPoint const&, QDateTime const&) () from /lib64/libkwin.so.5
#35 0x00007f6ed4298e1e in KWin::ScreenEdges::isEntered(xcb_enter_notify_event_t*) () from /lib64/libkwin.so.5
#36 0x00007f6ed41ef54f in KWin::Workspace::workspaceEvent(xcb_generic_event_t*) () from /lib64/libkwin.so.5
#37 0x00007f6ecbd8633c in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () from /lib64/libQt5Core.so.5
#38 0x00007f6eb2b6dfb5 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () from /lib64/libQt5XcbQpa.so.5
#39 0x00007f6eb2b6ef16 in QXcbConnection::processXcbEvents() () from /lib64/libQt5XcbQpa.so.5
#40 0x00007f6ecbdb0871 in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5
#41 0x00007f6ecc61810c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#42 0x00007f6ecc61d646 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#43 0x00007f6ecbd883ea in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#44 0x00007f6ecbd8a40a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQt5Core.so.5
#45 0x00007f6ecbdd4ae2 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#46 0x00007f6eb2bddfdd in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5XcbQpa.so.5
#47 0x00007f6ecbd8725a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#48 0x00007f6ecbd8ebdc in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#49 0x00007f6ed45b6636 in kdemain () from /lib64/libkdeinit5_kwin_x11.so
#50 0x00007f6ecaf0b580 in __libc_start_main () from /lib64/libc.so.6
#51 0x000055e594eb7d49 in _start ()

Reported using DrKonqi
Comment 1 Martin Flöser 2016-09-15 06:09:48 UTC
Unfortunately the backtrace is lacking debug symbols. We don't see where in the code the crash happens. If able please install debug symbols.

From what we see the crash happens inside Qt when trying to create a window and triggers a terminating X error. If we have the line numbers we can check what goes wrong and forward the bug to Qt.
Comment 2 Christophe Larsonneur 2016-09-15 08:35:54 UTC
ok. I will install debuginfo stuff then.

I will try to generate a coredump on the freezed process, before it crash. Because this is the issue I have.

Thank you Martin.
Comment 3 Christophe Larsonneur 2016-09-15 12:06:50 UTC
I have kwin freezing again. Thank gdb, I found it is looping  at 
/usr/src/debug/kwin-5.7.3/effects/presentwindows/presentwindows.cpp:1320

I noticed also that renderer is set to OpenGL 3.1
It looks like OpenGL 2.0 is a little bit faster in term of effects. (or more smooth) I'm wondering if my issue is not coming from the OpenGL version 3.1. (with nvidia driver)

I switched to 2.0 and I will see if the issue still happen or not.
Comment 4 Martin Flöser 2016-09-15 13:25:41 UTC
> /usr/src/debug/kwin-5.7.3/effects/presentwindows/presentwindows.cpp:1320

It's looping there? That one should exit. But we have had reports about that before.

Can you check what kind of windows you have and see whether there is some window responsible for it. Or some layout?
Comment 5 Christophe Larsonneur 2016-09-15 13:36:16 UTC
ok. Interesting. 

How can I check if there is one window or layout doing the freeze? Is there any way to get them?

How do you suggest me to identify those windows?
Comment 6 Martin Flöser 2016-09-15 14:08:26 UTC
> How do you suggest me to identify those windows?

Maybe xwininfo -tree?
Comment 7 Christophe Larsonneur 2016-09-16 09:11:12 UTC
Hi,

I think I found the window that break the 3d effect and causing kwin to freeze:
hp myroom (java app)

Do you think that kwin could do something to avoid this kind of freeze because of a window?
Comment 8 Martin Flöser 2016-09-16 09:16:09 UTC
(In reply to Christophe Larsonneur from comment #7)
> Hi,
> 
> I think I found the window that break the 3d effect and causing kwin to
> freeze:
> hp myroom (java app)

where can one get this app?

> 
> Do you think that kwin could do something to avoid this kind of freeze
> because of a window?

yes, once we have a way to reproduce, we can investigate and fix it.
Comment 9 Christophe Larsonneur 2016-09-16 11:51:57 UTC
This is where I downloaded the hp myroom tool:

https://www.myroom.hpe.com/Download
Comment 10 Christophe Larsonneur 2016-09-16 15:35:52 UTC
FYI: I stopped the hp myroom tool and all were good until the time I used it back!

So, another freeze occurs and then, I decided to kill hpmyroom process. But kwin did not recover from his freeze state. The process is still at 100% CPU, at this time.  As soon as I have the final coredump, I can send it here also.

I don't know if it can help you guys. Just tell me.

If you need anything else from my side, do not hesitate.
Comment 11 Elvis Angelaccio 2016-10-21 14:48:44 UTC
I have a similar issue. Here (Intel graphics,  Xorg session) kwin freezes only  when I trigger the desktop grid _with_ a second monitor attached. Though it doesn't always happen, just randomly.
Comment 12 unsuspicious.fakename+kdebugs 2016-12-23 17:20:18 UTC
Same problem here, don't have any "weird windows" as far as I can tell. Did you use some sort of debugging trick to find out which window is the cause or just trial and error?
Comment 13 Martin Flöser 2017-01-19 06:09:10 UTC
*** Bug 375268 has been marked as a duplicate of this bug. ***
Comment 14 S.Trzmiel 2017-07-07 15:16:47 UTC
Same here, Fedora/Intel IvyBridge gfx. Can't remember when it started exactly but somwhere around Plasma 5.4. Really can't get what trigger the bug. One day I can trigger it almost every time and then it can work flawlessly for weeks.
Usual running apps are Firefox, Qupzilla, Kontact, Konsole and Kate. Also Skype, qTox, Konversation and Amarok in tray.
Kwin usually uses OGl 3.1 renderer, but it also hapend when using OGL 2.0
Comment 15 laggerfromrussia 2018-06-30 09:15:05 UTC
Looks like I found new way to workaround this issue.
I tried to send SIGABRT (pkill -6 kwin)
and kwin continue normal work after little screen reload.
Way with --replace breaks windows title size for me (make them huge).
Comment 16 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 364709, bug 380865

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 17 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 364709, bug 380865

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