Bug 411420

Summary: KWin crashes when resuming from sleep in system with NVIDIA card
Product: [Plasma] kwin Reporter: Zahed Rimon <zahed.rimon>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash CC: kde
Priority: NOR Keywords: drkonqi
Version: 5.16.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Zahed Rimon 2019-08-29 13:43:11 UTC
Application: kwin_x11 (5.16.4)

Qt Version: 5.13.0
Frameworks Version: 5.61.0
Operating System: Linux 5.2.9-arch1-1-ARCH x86_64
Distribution (Platform): Archlinux Packages

-- Information about the crash:
Everytime after resuming system from sleep desktop icons become distorted. But everyting is usable. 

As a workaround switching to anohter tty and then going to tty1 fixes the desktop icons but KWin crashed report pops up and KWin window manager reports:
"Desktop effects were restarted due to a graphics reset"

Steps to reproduce: 
1.Put the system into sleep.
2.Resume the system.

The crash can be reproduced every time.

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

Thread 6 (Thread 0x7fcdfc818700 (LWP 17881)):
#0  0x00007fce07612756 in ppoll () at /usr/lib/libc.so.6
#1  0x00007fce06150913 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/libQt5Core.so.5
#2  0x00007fce06151fa3 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#3  0x00007fce060fb5ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007fce05f2e2f5 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#5  0x00007fce05f2f520 in  () at /usr/lib/libQt5Core.so.5
#6  0x00007fce050a257f in start_thread () at /usr/lib/libpthread.so.0
#7  0x00007fce0761d0e3 in clone () at /usr/lib/libc.so.6

Thread 5 (Thread 0x7fcde6c4d700 (LWP 17658)):
#0  0x00007fce050a8415 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007fce059b7edc in  () at /usr/lib/libQt5Script.so.5
#2  0x00007fce059b7ef9 in  () at /usr/lib/libQt5Script.so.5
#3  0x00007fce050a257f in start_thread () at /usr/lib/libpthread.so.0
#4  0x00007fce0761d0e3 in clone () at /usr/lib/libc.so.6

Thread 4 (Thread 0x7fcdefce0700 (LWP 17598)):
#0  0x00007fce07612756 in ppoll () at /usr/lib/libc.so.6
#1  0x00007fce06150913 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/libQt5Core.so.5
#2  0x00007fce06151fa3 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#3  0x00007fce060fb5ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007fce05f2e2f5 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#5  0x00007fce0482f8f9 in  () at /usr/lib/libQt5Qml.so.5
#6  0x00007fce05f2f520 in  () at /usr/lib/libQt5Core.so.5
#7  0x00007fce050a257f in start_thread () at /usr/lib/libpthread.so.0
#8  0x00007fce0761d0e3 in clone () at /usr/lib/libc.so.6

Thread 3 (Thread 0x7fcdfda7a700 (LWP 17564)):
#0  0x00007fce07612756 in ppoll () at /usr/lib/libc.so.6
#1  0x00007fce06150913 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/libQt5Core.so.5
#2  0x00007fce06151fa3 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#3  0x00007fce060fb5ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007fce05f2e2f5 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#5  0x00007fce04260b37 in  () at /usr/lib/libQt5DBus.so.5
#6  0x00007fce05f2f520 in  () at /usr/lib/libQt5Core.so.5
#7  0x00007fce050a257f in start_thread () at /usr/lib/libpthread.so.0
#8  0x00007fce0761d0e3 in clone () at /usr/lib/libc.so.6

Thread 2 (Thread 0x7fcdfe956700 (LWP 17549)):
#0  0x00007fce07612667 in poll () at /usr/lib/libc.so.6
#1  0x00007fce05e4f630 in  () at /usr/lib/libxcb.so.1
#2  0x00007fce05e512db in xcb_wait_for_event () at /usr/lib/libxcb.so.1
#3  0x00007fcdfec6f049 in  () at /usr/lib/libQt5XcbQpa.so.5
#4  0x00007fce05f2f520 in  () at /usr/lib/libQt5Core.so.5
#5  0x00007fce050a257f in start_thread () at /usr/lib/libpthread.so.0
#6  0x00007fce0761d0e3 in clone () at /usr/lib/libc.so.6

Thread 1 (Thread 0x7fcdff105880 (LWP 17505)):
[KCrash Handler]
#6  0x00007fce05bd8329 in  () at /usr/lib/libkwin4_effect_builtins.so.1
#7  0x00007fce05bd83e7 in  () at /usr/lib/libkwin4_effect_builtins.so.1
#8  0x00007fce05bda2f2 in  () at /usr/lib/libkwin4_effect_builtins.so.1
#9  0x00007fce05bdad20 in  () at /usr/lib/libkwin4_effect_builtins.so.1
#10 0x00007fce0739e4f4 in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#11 0x00007fce05b419bd in  () at /usr/lib/libkwin4_effect_builtins.so.1
#12 0x00007fce0739e4f4 in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#13 0x00007fce0738ca5c in KWin::Scene::finalPaintWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#14 0x00007fce0739e382 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#15 0x00007fce05c3d0ac in KWin::Effect::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwineffects.so.12
#16 0x00007fce0739e324 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#17 0x00007fce05c3d0ac in KWin::Effect::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwineffects.so.12
#18 0x00007fce0739e324 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) () at /usr/lib/libkwin.so.5
#19 0x00007fce07393517 in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion, KWin::WindowQuadList) () at /usr/lib/libkwin.so.5
#20 0x00007fce0738fd59 in KWin::Scene::paintSimpleScreen(int, QRegion) () at /usr/lib/libkwin.so.5
#21 0x00007fcdefd06fa5 in  () at /usr/lib/qt/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#22 0x00007fce07392a91 in KWin::Scene::finalPaintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwin.so.5
#23 0x00007fce0739e0e4 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwin.so.5
#24 0x00007fce05c3d000 in KWin::Effect::paintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwineffects.so.12
#25 0x00007fce0739e08e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwin.so.5
#26 0x00007fce05c3d000 in KWin::Effect::paintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwineffects.so.12
#27 0x00007fce0739e08e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion, KWin::ScreenPaintData&) () at /usr/lib/libkwin.so.5
#28 0x00007fce0739272c in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, QMatrix4x4 const&, QRect const&) () at /usr/lib/libkwin.so.5
#29 0x00007fcdefd0f9af in KWin::SceneOpenGL::paint(QRegion, QList<KWin::Toplevel*>) () at /usr/lib/qt/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#30 0x00007fce07383f03 in KWin::Compositor::performCompositing() () at /usr/lib/libkwin.so.5
#31 0x00007fce061293e5 in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#32 0x00007fce06ab44d5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#33 0x00007fce06abda21 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#34 0x00007fce060fc9c2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#35 0x00007fce06153d3d in QTimerInfoList::activateTimers() () at /usr/lib/libQt5Core.so.5
#36 0x00007fce06152109 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#37 0x00007fcdfec7039f in  () at /usr/lib/libQt5XcbQpa.so.5
#38 0x00007fce060fb5ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#39 0x00007fce06103326 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#40 0x00007fce076ed588 in kdemain () at /usr/lib/libkdeinit5_kwin_x11.so
#41 0x00007fce07547ee3 in __libc_start_main () at /usr/lib/libc.so.6
#42 0x000055f4d556205e in _start ()
[Inferior 1 (process 17505) detached]

Reported using DrKonqi
Comment 1 David Edmundson 2019-08-29 13:59:25 UTC

*** This bug has been marked as a duplicate of bug 399499 ***
Comment 2 Vlad Zahorodnii 2019-08-29 14:05:05 UTC
@David I think it was a crash in uploadRegion. Do you think that crash in uploadRegion and makeInterleavedArrays caused by us not properly handling graphics reset?
Comment 3 David Edmundson 2019-08-29 14:40:53 UTC
I think so.

A resume from sleep is the main place we get a context loss.
Comment 4 Vlad Zahorodnii 2019-08-29 14:42:11 UTC
Okay, thanks