Bug 388127 - Kwin crashes when switching desktops
Summary: Kwin crashes when switching desktops
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.11.4
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-21 21:40 UTC by Ted Parvu
Modified: 2019-01-03 11:57 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Change how the timer is stoped (867 bytes, patch)
2018-02-27 18:05 UTC, Pedro Arthur Duarte (aka JEdi)
Details
kwin's backtrace when exit is called (8.64 KB, text/plain)
2018-02-28 01:09 UTC, Pedro Arthur Duarte (aka JEdi)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ted Parvu 2017-12-21 21:40:41 UTC
This could be the same bug as #386370 but I am not sure. I don't have a backtrace. I'll try and install versions with debug info but I wanted to file this now.

I have tried different desktop switching effects, and I think what is causing the issue is the "Desktop Switch On-Screen Display" option.

kwin crashes somewhat randomly when switching desktops. But it is fairly regularly. I ran "kwin_x11" in a Konsole and before it crashes I get messages like this;


QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QXcbConnection: XCB error: 3 (BadWindow), sequence: 64494, resource id: 130023438, major code: 18 (ChangeProperty), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 1686, resource id: 130023438, major code: 18 (ChangeProperty), minor code: 0
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined
The X11 connection broke: No error (code 0)
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 96363 requests (96363 known processed) with 0 events remaining.


As this might help as well;

>kwin_x11 
QXcbConnection: XCB error: 3 (BadWindow), sequence: 172, resource id: 127926294, major code: 20 (GetProperty), minor code: 0
OpenGL vendor string:                   NVIDIA Corporation
OpenGL renderer string:                 GeForce GTX 760/PCIe/SSE2
OpenGL version string:                  4.6.0 NVIDIA 387.34
OpenGL shading language version string: 4.60 NVIDIA
Driver:                                 NVIDIA
Driver version:                         387.34
GPU class:                              Unknown
OpenGL version:                         4.6
GLSL version:                           4.60
X server version:                       1.19.5
Linux kernel version:                   4.14.7
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no


Just by experiment I turned off the "Desktop Switch On-Screen Display" option and I don't seem to be crashing now.

You can try and reproduce by turning that option on and switching desktops multiple times until kwin crashes. Once kwin crashes, I am able to run it again in a console and continue working.
Comment 1 Martin Flöser 2017-12-22 07:45:36 UTC
Please add the backtrace of the crash.
Comment 2 Laurent RINEAU 2018-01-04 14:44:51 UTC
I reproduce the issue. There is no easy way to produce a backtrace, because the kwin process exists with exit code 1. It does not crash.

Note that in my case I use the NVidia Linux driver. That is probably relevant, because kwin seems to crash/exit because of a XCB error.
Comment 3 Laurent RINEAU 2018-01-04 17:50:31 UTC
(In reply to Laurent RINEAU from comment #2)
> I reproduce the issue. There is no easy way to produce a backtrace, because
> the kwin process exists with exit code 1. It does not crash.

I wanted to say "the kwin process exits with exit code 1".
Comment 4 Pedro Arthur Duarte (aka JEdi) 2018-02-27 18:05:04 UTC
Created attachment 111060 [details]
Change how the timer is stoped

Although I am also unable to provide a dump as kwin seems to exit gracefully (exit code is 1, however), the patch I am providing seems to fix the issue in my set-up.
Comment 5 Pedro Arthur Duarte (aka JEdi) 2018-02-27 18:08:08 UTC
By the way, I tried the solution in the patch because my console output also encompassed the following entries:

The X11 connection broke: No error (code 0)                                                                                        
XIO:  fatal IO error 17 (File exists) on X server ":0"                                                                        
      after 5926 requests (5926 known processed) with 0 events remaining.
QObject::~QObject: Timers cannot be stopped from another thread
QThread::wait: Thread tried to wait on itself                                      
QtDBus: cannot relay signals from parent QObject(0x5581a4545240 "") unless they are emitted in the object's thread QThread(0x5581a44a5360 ""). Current thread is QSGRenderThre
ad(0x7f59d8016ee0 "").
Comment 6 Pedro Arthur Duarte (aka JEdi) 2018-02-28 01:09:23 UTC
Created attachment 111074 [details]
kwin's backtrace when exit is called

This is a backtrace of kwin in the moment when exit is called. Is this sufficient information?
Comment 7 Christoph Feck 2018-02-28 04:20:34 UTC
The backtrace from comment #6 confirms what is written in comment #5: The X11 connection is terminated, possibly because KWin tries to call glXSwapBuffers() for a non-exposed or already deleted window.

KWin cannot continue to work without the X11 connection, so it exit()s.
Comment 8 Martin Flöser 2018-02-28 05:17:20 UTC
The actual termination happens in QtQuick. Thus this is a Qt issue.
Comment 9 Mike Lui 2018-05-15 20:36:35 UTC
I've noticed this happening in KDE 5.12.5, KDE Frameworks 5.46 (ArchLinux)

To clarify, this is a Qt issue and we must wait for a fix in Qt?
Comment 10 Andrey 2018-07-18 20:40:21 UTC
Crash happens 100% of the time when I switch between virtual desktops while window is visible. This happens with default KDE 5.12.5 (LTS) which ships with openSUSE 15.0. 

This also happens with newer version (I updated both Qt and KDE packages just to check if the bug is still there):
KDE Plasma 5.13.3
KDE Framework Version 5.48.0
Qt Version: 5.11.1


So this is upstream issue...

Is there any upstream bug to track this? If someone knows, can you please post a link for the reference?

If there is no upstream bug report created, one should probably be created.
Comment 11 Thomas Rother 2018-07-19 09:55:45 UTC
As a refererence see https://bugzilla.opensuse.org/show_bug.cgi?id=1101560 for the same issue with switching desktops on current OpenSUSE Leap 15 (KDE 5.12.5, Frameworks 5.45.0, Qt 5.9.4), Kernel 4.12.14).
Comment 12 Bruno Finger 2019-01-03 08:59:54 UTC
I am experiencing this problem on Kubuntu 18.04.1 LTS.

It is really really easy to make kwin crash while switching virtual desktops, unfortunately making this feature unusable.

NVIDIA Driver Version: 396.54 on GeForce GTX 1050

I will try to disable the "Desktop Switch On-Screen Display" effect as mentioned in the comments and report back if any difference. As of right now, I cannot use virtual desktops.

Please let me know if I should reopen this or create a new bug for Kubuntu platform (as I see this ticket is specific to Arch)
Comment 13 Thomas Rother 2019-01-03 10:46:58 UTC
See comment 11 and referenced bug issue https://bugzilla.opensuse.org/show_bug.cgi?id=1101560. The problem described there was solved with a libxkb patch, it was deployed for both OpenSUSE Leap 15.0 and SLES:

------------
openSUSE-RU-2018:3294-1: An update that has one recommended fix can now be installed.

Category: recommended (moderate)
Bug References: 1101560
CVE References: 
Sources used:
openSUSE Leap 15.0 (src):    libxcb-1.13-lp150.2.3.1 
------------
Comment 14 Andrey 2019-01-03 11:57:14 UTC
Confirming that in openSUSE Leap 15.0 libxcb-1.13-lp150.2.3.1 works.

I re-enabled "Desktop Switch On-Screen Display" - no crashes.

x11-video-nvidiaG04 package version: 390.87-lp150.10.2.