Bug 440318

Summary: KWin crashes inside updateOffscreenTexture upon alt+tab
Product: [Plasma] kwin Reporter: David Redondo <kde>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: nate
Priority: VHI Keywords: drkonqi, regression
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.23
Sentry Crash Report:

Description David Redondo 2021-07-27 09:06:37 UTC
Application: kwin_x11 (5.22.80)

Qt Version: 5.15.3
Frameworks Version: 5.85.0
Operating System: Linux 5.8.0-63-generic x86_64
Windowing System: X11
Distribution: KDE neon Unstable Edition
DrKonqi: 5.22.80 [CoredumpBackend]

-- Information about the crash:
Kwin crashed after pressing alt tab

Does not happen always but happened multiple times today

The crash can be reproduced sometimes.

-- Backtrace:
Application: KWin (kwin_x11), signal: Segmentation fault

[New LWP 21622]
[New LWP 21647]
[New LWP 21664]
[New LWP 21655]
[New LWP 21636]
[New LWP 21813]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/bin/kwin_x11 --crashes 1'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x7f899bc909c0 (LWP 21622))]
__preamble__
[Current thread is 1 (Thread 0x7f899bc909c0 (LWP 21622))]

Thread 6 (Thread 0x7f899229b700 (LWP 21813)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5627bad0d780) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5627bad0d730, cond=0x5627bad0d758) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x5627bad0d758, mutex=0x5627bad0d730) at pthread_cond_wait.c:647
#3  0x00007f89a1f69f2b in QWaitConditionPrivate::wait(QDeadlineTimer) (deadline=..., this=0x5627bad0d730) at thread/qwaitcondition_unix.cpp:146
#4  QWaitCondition::wait(QMutex*, QDeadlineTimer) (this=this@entry=0x5627bad0d618, mutex=mutex@entry=0x5627bad0d610, deadline=...) at thread/qwaitcondition_unix.cpp:225
#5  0x00007f89a05d1b44 in QSGRenderThreadEventQueue::takeEvent(bool) (wait=true, this=0x5627bad0d608) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qdeadlinetimer.h:68
#6  QSGRenderThread::processEventsAndWaitForMore() (this=this@entry=0x5627bad0d570) at scenegraph/qsgthreadedrenderloop.cpp:936
#7  0x00007f89a05d1fb9 in QSGRenderThread::run() (this=0x5627bad0d570) at scenegraph/qsgthreadedrenderloop.cpp:1053
#8  0x00007f89a1f63dbc in QThreadPrivate::start(void*) (arg=0x5627bad0d570) at thread/qthread_unix.cpp:329
#9  0x00007f899fd8e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007f89a1378293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f899377d700 (LWP 21636)):
#0  0x00007f89a136bbf6 in __ppoll (fds=fds@entry=0x7f898c0098b8, nfds=nfds@entry=3, timeout=<optimized out>, timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:44
#1  0x00007f89a21a0ec9 in ppoll (__ss=<optimized out>, __timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/poll2.h:77
#2  qt_ppoll (timeout_ts=0x0, nfds=3, fds=0x7f898c0098b8) at kernel/qcore_unix.cpp:132
#3  qt_ppoll (timeout_ts=0x0, nfds=3, fds=0x7f898c0098b8) at kernel/qcore_unix.cpp:129
#4  qt_safe_poll(pollfd*, unsigned long, timespec const*) (fds=0x7f898c0098b8, nfds=3, timeout_ts=timeout_ts@entry=0x0) at kernel/qcore_unix.cpp:155
#5  0x00007f89a21a2573 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:211
#6  0x00007f89a214925b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f899377cbb0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#7  0x00007f89a1f62c22 in QThread::exec() (this=this@entry=0x7f89a1e94d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#8  0x00007f89a1e10f4b in QDBusConnectionManager::run() (this=0x7f89a1e94d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at qdbusconnection.cpp:179
#9  0x00007f89a1f63dbc in QThreadPrivate::start(void*) (arg=0x7f89a1e94d80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread_unix.cpp:329
#10 0x00007f899fd8e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007f89a1378293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f8981e99700 (LWP 21655)):
#0  0x00007f89a136bbf6 in __ppoll (fds=fds@entry=0x7f8968000d98, nfds=nfds@entry=1, timeout=<optimized out>, timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:44
#1  0x00007f89a21a0ec9 in ppoll (__ss=<optimized out>, __timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/poll2.h:77
#2  qt_ppoll (timeout_ts=0x0, nfds=1, fds=0x7f8968000d98) at kernel/qcore_unix.cpp:132
#3  qt_ppoll (timeout_ts=0x0, nfds=1, fds=0x7f8968000d98) at kernel/qcore_unix.cpp:129
#4  qt_safe_poll(pollfd*, unsigned long, timespec const*) (fds=0x7f8968000d98, nfds=1, timeout_ts=timeout_ts@entry=0x0) at kernel/qcore_unix.cpp:155
#5  0x00007f89a21a2573 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:211
#6  0x00007f89a214925b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f8981e98be0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#7  0x00007f89a1f62c22 in QThread::exec() (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#8  0x00007f89a1f63dbc in QThreadPrivate::start(void*) (arg=0x7f899400bb90) at thread/qthread_unix.cpp:329
#9  0x00007f899fd8e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007f89a1378293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f8964c2d700 (LWP 21664)):
#0  0x00007f89a136e12b in __GI___select (nfds=42, readfds=0x7f8964c2cba0, writefds=0x0, exceptfds=0x0, timeout=0x7f8964c2cb90) at ../sysdeps/unix/sysv/linux/select.c:41
#1  0x00007f8998deb981 in  () at /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.460.91.03
#2  0x00007f8998de946a in  () at /usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.460.91.03
#3  0x00007f899fd8e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#4  0x00007f89a1378293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f89837fe700 (LWP 21647)):
#0  0x00007f89a136bbf6 in __ppoll (fds=fds@entry=0x7f8970000d78, nfds=nfds@entry=1, timeout=<optimized out>, timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:44
#1  0x00007f89a21a0ec9 in ppoll (__ss=<optimized out>, __timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/poll2.h:77
#2  qt_ppoll (timeout_ts=0x0, nfds=1, fds=0x7f8970000d78) at kernel/qcore_unix.cpp:132
#3  qt_ppoll (timeout_ts=0x0, nfds=1, fds=0x7f8970000d78) at kernel/qcore_unix.cpp:129
#4  qt_safe_poll(pollfd*, unsigned long, timespec const*) (fds=0x7f8970000d78, nfds=1, timeout_ts=timeout_ts@entry=0x0) at kernel/qcore_unix.cpp:155
#5  0x00007f89a21a2573 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:211
#6  0x00007f89a214925b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7f89837fdbc0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#7  0x00007f89a1f62c22 in QThread::exec() (this=this@entry=0x7f899400fef0) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#8  0x00007f89a0257559 in QQmlThreadPrivate::run() (this=0x7f899400fef0) at qml/ftw/qqmlthread.cpp:155
#9  0x00007f89a1f63dbc in QThreadPrivate::start(void*) (arg=0x7f899400fef0) at thread/qthread_unix.cpp:329
#10 0x00007f899fd8e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007f89a1378293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f899bc909c0 (LWP 21622)):
[KCrash Handler]
#3  0x00007f89a2534a5c in QWindow::devicePixelRatio() const (this=0x0) at kernel/qwindow.cpp:1310
#4  0x00007f89a2df6fba in KWin::WindowThumbnailItem::updateOffscreenTexture() (this=0x7f8994019a40) at ./src/scripting/thumbnailitem.cpp:342
#5  0x00007f89a218177e in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff48344880, r=0x7f8994019a40, this=0x5627ba803020) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#6  doActivate<false>(QObject*, int, void**) (sender=0x5627ba3c1390, signal_index=3, argv=0x7fff48344880) at kernel/qobject.cpp:3886
#7  0x00007f89a217ab47 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x5627ba3c1390, m=m@entry=0x7f89a2f7cc40 <KWin::Scene::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3946
#8  0x00007f89a2cb0444 in KWin::Scene::frameRendered() (this=this@entry=0x5627ba3c1390) at ./obj-x86_64-linux-gnu/src/kwin_autogen/EWIEGA46WW/moc_scene.cpp:166
#9  0x00007f89a2dc8f88 in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, KWin::RenderLoop*, QMatrix4x4 const&) (this=this@entry=0x5627ba3c1390, mask=mask@entry=0x7fff48344a3c, damage=..., repaint=..., updateRegion=updateRegion@entry=0x7fff48344a40, validRegion=validRegion@entry=0x7fff48344a48, renderLoop=0x5627b9fa8280, projection=...) at ./src/scene.cpp:196
#10 0x00007f899010571f in KWin::SceneOpenGL::paint(int, QRegion const&, QList<KWin::Toplevel*> const&, KWin::RenderLoop*) (this=0x5627ba3c1390, screenId=-1, damage=..., toplevels=..., renderLoop=0x5627b9fa8280) at ./src/plugins/scenes/opengl/scene_opengl.h:101
#11 0x00007f89a2cff308 in KWin::Compositor::composite(KWin::RenderLoop*) (this=this@entry=0x5627ba002bd0, renderLoop=renderLoop@entry=0x5627b9fa8280) at ./src/composite.cpp:620
#12 0x00007f89a2cff70a in KWin::X11Compositor::composite(KWin::RenderLoop*) (this=0x5627ba002bd0, renderLoop=<optimized out>) at ./src/composite.cpp:828
#13 0x00007f89a218177e in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff48344d40, r=0x5627ba002bd0, this=0x5627ba3e6e40) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#14 doActivate<false>(QObject*, int, void**) (sender=0x5627b9fa8280, signal_index=5, argv=0x7fff48344d40) at kernel/qobject.cpp:3886
#15 0x00007f89a217ab47 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f89a2f7ccc0 <KWin::RenderLoop::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7fff48344d40) at kernel/qobject.cpp:3946
#16 0x00007f89a2cb5146 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*) (this=<optimized out>, _t1=<optimized out>) at ./obj-x86_64-linux-gnu/src/kwin_autogen/EWIEGA46WW/moc_renderloop.cpp:206
#17 0x00007f89a2db7227 in KWin::RenderLoopPrivate::dispatch() (this=0x5627b9fa8360) at ./src/renderloop.cpp:162
#18 0x00007f89a218177e in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fff48344e70, r=0x5627b9fa8280, this=0x5627b9fa8470) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#19 doActivate<false>(QObject*, int, void**) (sender=0x5627b9fa8378, signal_index=3, argv=0x7fff48344e70) at kernel/qobject.cpp:3886
#20 0x00007f89a217ab47 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f89a23e6c80 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff48344e70) at kernel/qobject.cpp:3946
#21 0x00007f89a21862be in QTimer::timeout(QTimer::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
#22 0x00007f89a2178215 in QObject::event(QEvent*) (this=0x5627b9fa8378, e=0x7fff483451a0) at kernel/qobject.cpp:1336
#23 0x00007f89a17a0dc3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=0x5627b9d69940, receiver=receiver@entry=0x5627b9fa8378, e=e@entry=0x7fff483451a0) at kernel/qapplication.cpp:3632
#24 0x00007f89a17a9bb8 in QApplication::notify(QObject*, QEvent*) (this=0x7fff48345430, receiver=0x5627b9fa8378, e=0x7fff483451a0) at kernel/qapplication.cpp:3156
#25 0x00007f89a214a75a in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5627b9fa8378, event=0x7fff483451a0) at ../../include/QtCore/5.15.3/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:325
#26 0x00007f89a21a4300 in QTimerInfoList::activateTimers() (this=this@entry=0x5627b9d6fd18) at kernel/qtimerinfo_unix.cpp:643
#27 0x00007f89a21a19d0 in QEventDispatcherUNIXPrivate::activateTimers() (this=this@entry=0x5627b9d6fc90) at kernel/qeventdispatcher_unix.cpp:249
#28 0x00007f89a21a26c7 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at kernel/qeventdispatcher_unix.cpp:516
#29 0x00007f899b7fc232 in QXcbUnixEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5627b9e7a940, flags=...) at qxcbeventdispatcher.cpp:60
#30 0x00007f89a214925b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fff48345340, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#31 0x00007f89a2151414 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#32 0x00005627b91d2ae3 in main(int, char**) (argc=<optimized out>, argv=0x7fff483455e8) at ./src/main_x11.cpp:483

Possible duplicates by query: bug 439681, bug 439208, bug 438789, bug 437761, bug 437352.

Reported using DrKonqi
Comment 1 Nate Graham 2021-07-28 14:14:13 UTC
I have occasionally seen this recently as well.
Comment 2 Bug Janitor Service 2021-08-01 23:13:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1218
Comment 3 David Edmundson 2021-08-02 08:43:44 UTC
Git commit 47e38b7141a9e1ff3c93b37a2df24a8ae7d9781c by David Edmundson.
Committed on 02/08/2021 at 08:43.
Pushed by davidedmundson into branch 'master'.

Disconnect frame renders when ThumbnailItem has no window

It is perfectly valid to have a case where an item exists but has no
window. During these times the item will never be rendered.

Rather than guard in updateOffscreenTexture, it's more economical to
disable the frame rendering in the first place. Especially as then it's
easy to extend to item visibility.

M  +14   -4    src/scripting/thumbnailitem.cpp
M  +2    -1    src/scripting/thumbnailitem.h

https://invent.kde.org/plasma/kwin/commit/47e38b7141a9e1ff3c93b37a2df24a8ae7d9781c