Bug 494044 - kwin_wayland crashed sometimes in KWin::DrmGpu::presentationClock after Plasma dimmed/went black automatically and was resumed
Summary: kwin_wayland crashed sometimes in KWin::DrmGpu::presentationClock after Plasm...
Status: RESOLVED DUPLICATE of bug 496015
Alias: None
Product: kwin
Classification: Plasma
Component: generic-crash (show other bugs)
Version: 6.1.90
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2024-10-03 15:58 UTC by Matt Fagnani
Modified: 2024-11-13 11:21 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/53755


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Fagnani 2024-10-03 15:58:48 UTC
Application: kwin_wayland (6.1.90)

ApplicationNotResponding [ANR]: false
Qt Version: 6.7.2
Frameworks Version: 6.6.0
Operating System: Linux 6.12.0-0.rc1.17.fc42.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora Linux 42 (KDE Plasma Prerelease)"
DrKonqi: 6.1.90 [CoredumpBackend]

-- Information about the crash:
I was using Plasma 6.1.90 on Wayland in the Fedora Rawhide KDE Live image Fedora-KDE-Live-x86_64-Rawhide-20241002.n.1.iso from https://koji.fedoraproject.org/koji/buildinfo?buildID=2559225 in a QEMU/KVM VM in GNOME Boxes with 3D acceleration enabled using the virgl mesa driver and virtio-gpu kernel driver. I left the system idle for about 5 minutes, and Plasma in the VM went into an idle state. I moved the mouse to resume the VM. kwin_wayland crashed in Kwin::DrmGpu::presentationClock. drkonqi appeared. This is the first crash of this type I've seen. The journal before the crash showed errors like the following which might indicate a kernel GPU driver problem.

Oct 03 11:23:46 kwin_wayland_wrapper[2147]: waiting got error - 16, slow gpu or hang?
Oct 03 11:24:02 kwin_wayland_wrapper[2147]: waiting got error - 16, slow gpu or hang?
Oct 03 11:24:07 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:12 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:17 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:17 kwin_wayland_wrapper[2147]: waiting got error - 16, slow gpu or hang?
Oct 03 11:24:22 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:27 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:32 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:33 kwin_wayland_wrapper[2147]: waiting got error - 16, slow gpu or hang?
Oct 03 11:24:38 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:43 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:48 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug
Oct 03 11:24:53 kwin_wayland[2147]: kwin_wayland_drm: Pageflip timed out! This is a kernel bug

The reporter is unsure if this crash is reproducible.

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


This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.

warning: Can't open file /memfd:JSGCHeap:QtQml (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:JSVMStack:QtQml (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:JITCode:QtQml (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:kwayland-shared (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:unknown-usage:QtQml (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:xwayland-shared (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:wayland-shm (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:wayland-cursor (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:gdk-wayland (deleted) during file-backed mapping note processing

warning: Can't open file /home/liveuser/.cache/plasma_theme_breeze-dark.kcache (deleted) during file-backed mapping note processing
[New LWP 2147]
[New LWP 2239]
[New LWP 2234]
[New LWP 2235]
[New LWP 2230]
[New LWP 2237]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8 --xwayl'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f9dd7280944 in __pthread_kill_implementation () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f9dd9b8bb80 (LWP 2147))]
Cannot QML trace cores :(
/usr/share/drkonqi/gdb/python/gdb_preamble/preamble.py:516: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
  boot_time = datetime.utcfromtimestamp(psutil.boot_time()).strftime('%Y-%m-%dT%H:%M:%S')
Python Exception <class 'gdb.error'>: value has been optimized out
Python Exception <class 'gdb.error'>: value has been optimized out
/usr/share/drkonqi/gdb/python/gdb_preamble/preamble.py:533: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  'timestamp': datetime.utcnow().isoformat(),
[Current thread is 1 (Thread 0x7f9dd9b8bb80 (LWP 2147))]

Thread 6 (Thread 0x7f9db64006c0 (LWP 2237)):
#0  0x00007f9dd7286d72 in __syscall_cancel_arch () from /lib64/libc.so.6
#1  0x00007f9dd727ac13 in __internal_syscall_cancel () from /lib64/libc.so.6
#2  0x00007f9dd727ac54 in __syscall_cancel () from /lib64/libc.so.6
#3  0x00007f9dd72f47c6 in ppoll () from /lib64/libc.so.6
#4  0x00007f9dd649ec63 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#5  0x00007f9dd643fb03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#6  0x00007f9dd7bd5023 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#7  0x00007f9dd78f3b43 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#8  0x00007f9dd7a07e4f in QThread::exec() () from /lib64/libQt6Core.so.6
#9  0x00007f9dd7aa4626 in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#10 0x00007f9dd727eae7 in start_thread () from /lib64/libc.so.6
#11 0x00007f9dd730179c in __clone3 () from /lib64/libc.so.6

Thread 5 (Thread 0x7f9db88006c0 (LWP 2230)):
#0  0x00007f9dd7286d72 in __syscall_cancel_arch () from /lib64/libc.so.6
#1  0x00007f9dd727ac13 in __internal_syscall_cancel () from /lib64/libc.so.6
#2  0x00007f9dd727ac54 in __syscall_cancel () from /lib64/libc.so.6
#3  0x00007f9dd72f47c6 in ppoll () from /lib64/libc.so.6
#4  0x00007f9dd649ec63 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#5  0x00007f9dd643fb03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#6  0x00007f9dd7bd5023 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#7  0x00007f9dd78f3b43 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#8  0x00007f9dd7a07e4f in QThread::exec() () from /lib64/libQt6Core.so.6
#9  0x00007f9dd8b4ee41 in QDBusConnectionManager::run() () from /lib64/libQt6DBus.so.6
#10 0x00007f9dd7aa4626 in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#11 0x00007f9dd727eae7 in start_thread () from /lib64/libc.so.6
#12 0x00007f9dd730179c in __clone3 () from /lib64/libc.so.6

Thread 4 (Thread 0x7f9db6e006c0 (LWP 2235)):
#0  0x00007f9dd7286d72 in __syscall_cancel_arch () from /lib64/libc.so.6
#1  0x00007f9dd727ac13 in __internal_syscall_cancel () from /lib64/libc.so.6
#2  0x00007f9dd727ac54 in __syscall_cancel () from /lib64/libc.so.6
#3  0x00007f9dd72f47c6 in ppoll () from /lib64/libc.so.6
#4  0x00007f9dd649ec63 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#5  0x00007f9dd643fb03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#6  0x00007f9dd7bd5023 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#7  0x00007f9dd78f3b43 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#8  0x00007f9dd7a07e4f in QThread::exec() () from /lib64/libQt6Core.so.6
#9  0x00007f9dd7aa4626 in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#10 0x00007f9dd727eae7 in start_thread () from /lib64/libc.so.6
#11 0x00007f9dd730179c in __clone3 () from /lib64/libc.so.6

Thread 3 (Thread 0x7f9db78006c0 (LWP 2234)):
#0  0x00007f9dd7286d72 in __syscall_cancel_arch () from /lib64/libc.so.6
#1  0x00007f9dd727ac13 in __internal_syscall_cancel () from /lib64/libc.so.6
#2  0x00007f9dd727b28c in __futex_abstimed_wait_common () from /lib64/libc.so.6
#3  0x00007f9dd727dc39 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#4  0x00007f9dd28be13d in cnd_wait () from /lib64/libgallium-24.2.3.so
#5  0x00007f9dd289a92b in util_queue_thread_func () from /lib64/libgallium-24.2.3.so
#6  0x00007f9dd28be06c in impl_thrd_routine () from /lib64/libgallium-24.2.3.so
#7  0x00007f9dd727eae7 in start_thread () from /lib64/libc.so.6
#8  0x00007f9dd730179c in __clone3 () from /lib64/libc.so.6

Thread 2 (Thread 0x7f9db50006c0 (LWP 2239)):
#0  0x00007f9dd7286d72 in __syscall_cancel_arch () from /lib64/libc.so.6
#1  0x00007f9dd727ac13 in __internal_syscall_cancel () from /lib64/libc.so.6
#2  0x00007f9dd72cac62 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
#3  0x00007f9dd72d6c87 in nanosleep () from /lib64/libc.so.6
#4  0x00007f9dda8e322c in std::this_thread::sleep_for<long, std::ratio<1l, 1000000000l> > (__rtime=...) at /usr/include/c++/14/bits/this_thread_sleep.h:80
#5  std::this_thread::sleep_until<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__atime=...) at /usr/include/c++/14/bits/this_thread_sleep.h:99
#6  operator() (__closure=<optimized out>) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_commit_thread.cpp:60
#7  std::__invoke_impl<void, KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> > (__f=...) at /usr/include/c++/14/bits/invoke.h:61
#8  std::__invoke<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> > (__fn=...) at /usr/include/c++/14/bits/invoke.h:96
#9  std::invoke<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> > (__fn=...) at /usr/include/c++/14/functional:120
#10 operator()<> (__closure=<optimized out>) at /usr/include/qt6/QtCore/qthread.h:125
#11 std::__invoke_impl<void, QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > (__f=...) at /usr/include/c++/14/bits/invoke.h:61
#12 std::__invoke<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > (__fn=...) at /usr/include/c++/14/bits/invoke.h:96
#13 std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >::_M_invoke<0> (this=<optimized out>) at /usr/include/c++/14/bits/std_thread.h:301
#14 std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >::operator() (this=<optimized out>) at /usr/include/c++/14/bits/std_thread.h:308
#15 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >, void>::operator() (this=0x7f9db4fff9a0) at /usr/include/c++/14/future:1439
#16 std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >, void>&> (__f=...) at /usr/include/c++/14/bits/invoke.h:61
#17 std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >, void>&> (__fn=...) at /usr/include/c++/14/bits/invoke.h:114
#18 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>(), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >, void> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/14/bits/std_function.h:291
#19 0x00007f9dda8dd206 in std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>::operator() (this=<optimized out>) at /usr/include/c++/14/bits/std_function.h:591
#20 std::__future_base::_State_baseV2::_M_do_set (this=0x564cf55268f0, __f=<optimized out>, __did_set=0x7f9db4fff957) at /usr/include/c++/14/future:596
#21 0x00007f9dd7283d2b in __pthread_once_slow.isra.0 () from /lib64/libc.so.6
#22 0x00007f9dd7283d99 in pthread_once@GLIBC_2.2.5 () from /lib64/libc.so.6
#23 0x00007f9dda8dde73 in __gthread_once (__once=0x564cf5526908, __func=<optimized out>) at /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h:713
#24 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()>*, bool*> (__once=..., __f=@0x7f9db4fff970: (void (std::__future_base::_State_baseV2::*)(class std::__future_base::_State_baseV2 * const, class std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x7f9dda8dd1d0 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>) at /usr/include/c++/14/mutex:916
#25 std::__future_base::_State_baseV2::_M_set_result (this=0x564cf55268f0, __res=..., __ignore_failure=true) at /usr/include/c++/14/future:435
#26 std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<QThread::create<KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()> >(KWin::DrmCommitThread::DrmCommitThread(KWin::DrmGpu*, const QString&)::<lambda()>&&)::<lambda(auto:48&& ...)> > >, void>::_M_complete_async(void) (this=0x564cf55268f0) at /usr/include/c++/14/future:1712
#27 0x00007f9dd7a08317 in QThreadCreateThread::run() () from /lib64/libQt6Core.so.6
#28 0x00007f9dd7aa4626 in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#29 0x00007f9dd727eae7 in start_thread () from /lib64/libc.so.6
#30 0x00007f9dd730179c in __clone3 () from /lib64/libc.so.6

Thread 1 (Thread 0x7f9dd9b8bb80 (LWP 2147)):
[KCrash Handler]
#4  KWin::DrmGpu::presentationClock (this=0xcb71386c291b0381) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:131
#5  KWin::DrmGpu::pageFlipHandler (fd=22, sequence=0, sec=2683, usec=631215, crtc_id=36, user_data=0x7f9d9800a470) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:566
#6  0x00007f9dd7739580 in drmHandleEvent (fd=22, evctx=0x7fffbef87cc0) at ../xf86drmMode.c:1070
#7  0x00007f9dda8f0b8c in KWin::DrmGpu::dispatchEvents (this=<optimized out>) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:581
#8  0x00007f9dd794c872 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
#9  0x00007f9dd795a44d in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () from /lib64/libQt6Core.so.6
#10 0x00007f9dd795ac5b in QSocketNotifier::event(QEvent*) () from /lib64/libQt6Core.so.6
#11 0x00007f9dd8c3d218 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt6Widgets.so.6
#12 0x00007f9dd78e6e08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt6Core.so.6
#13 0x00007f9dd7aa68c6 in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () from /lib64/libQt6Core.so.6
#14 0x00007f9dd7aa71d4 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#15 0x00007f9dd8656492 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Gui.so.6
#16 0x00007f9dd78f3b43 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#17 0x00007f9dd78ef9fc in QCoreApplication::exec() () from /lib64/libQt6Core.so.6
#18 0x0000564cb5f588de in main ()

Reported using DrKonqi
Comment 1 Matt Fagnani 2024-10-03 23:12:55 UTC
coredumpctl gdb showed that in KWin::DrmGpu::presentationClock the pointers this and m_presentationClock appeared to be invalid or corrupted since dereferencing them resulted in errors like "Cannot access memory at address 0xcb71386c291b0381" and similarly in KWin::DrmGpu::pageFlipHandler for the pointer gpu in frame 5. The pageflip timeouts might've been related to such problems.

Core was generated by `/usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8 --xwayl'.
Program terminated with signal SIGSEGV, Segmentation fault.
--Type <RET> for more, q to quit, c to continue without paging--c
#0  0x00007f9dd7280944 in __pthread_kill_implementation () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f9dd9b8bb80 (LWP 2147))]

(gdb) bt
#0  0x00007f9dd7280944 in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007f9dd722825e in raise () from /lib64/libc.so.6
#2  0x00007f9ddaeaa1a2 in KCrash::defaultCrashHandler(int) () from /lib64/libKF6Crash.so.6
#3  <signal handler called>
#4  KWin::DrmGpu::presentationClock (this=0xcb71386c291b0381) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:131
#5  KWin::DrmGpu::pageFlipHandler (fd=22, sequence=0, sec=2683, usec=631215, crtc_id=36, user_data=0x7f9d9800a470)
    at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:566
#6  0x00007f9dd7739580 in drmHandleEvent (fd=22, evctx=0x7fffbef87cc0) at ../xf86drmMode.c:1070
#7  0x00007f9dda8f0b8c in KWin::DrmGpu::dispatchEvents (this=<optimized out>) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:581
#8  0x00007f9dd794c872 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
#9  0x00007f9dd795a44d in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () from /lib64/libQt6Core.so.6
#10 0x00007f9dd795ac5b in QSocketNotifier::event(QEvent*) () from /lib64/libQt6Core.so.6
#11 0x00007f9dd8c3d218 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt6Widgets.so.6
#12 0x00007f9dd78e6e08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt6Core.so.6
#13 0x00007f9dd7aa68c6 in QEventDispatcherUNIXPrivate::activateSocketNotifiers() () from /lib64/libQt6Core.so.6
#14 0x00007f9dd7aa71d4 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#15 0x00007f9dd8656492 in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Gui.so.6
#16 0x00007f9dd78f3b43 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#17 0x00007f9dd78ef9fc in QCoreApplication::exec() () from /lib64/libQt6Core.so.6
#18 0x0000564cb5f588de in main ()

(gdb) frame 4
#4  KWin::DrmGpu::presentationClock (this=0xcb71386c291b0381) at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:131
131         return m_presentationClock;
(gdb) p this
$1 = (const KWin::DrmGpu * const) 0xcb71386c291b0381
(gdb) p *this
Cannot access memory at address 0xcb71386c291b0381
(gdb) p m_presentationClock
Cannot access memory at address 0xcb71386c291b03ad

(gdb) frame 5
#5  KWin::DrmGpu::pageFlipHandler (fd=22, sequence=0, sec=2683, usec=631215, crtc_id=36, user_data=0x7f9d9800a470)
    at /usr/src/debug/kwin-6.1.90-4.fc42.x86_64/src/backends/drm/drm_gpu.cpp:566
566         std::chrono::nanoseconds timestamp = convertTimestamp(gpu->presentationClock(), CLOCK_MONOTONIC,

(gdb) p gpu
$3 = (KWin::DrmGpu * const) 0xcb71386c291b0381
(gdb) p *gpu
Cannot access memory at address 0xcb71386c291b0381

The idle state I mentioned involved a dimming or shutting off of the VM screen with a lock screen possibly briefly shown. In Power Management in System Settings, the Dim automatically setting was 5 minutes and Turn off screen was 10 minutes by default. The VM's screen was dimmer than usual after kwin crashed.
Comment 2 Vlad Zahorodnii 2024-10-04 11:26:35 UTC
Does it happen often enough?
Comment 3 Matt Fagnani 2024-10-04 13:25:42 UTC
(In reply to Vlad Zahorodnii from comment #2)
> Does it happen often enough?

I saw this problem 1/4 times I let the VM's screen go black by leaving it idle. The problem might involve a race condition. The gpu pointer in KWin::DrmGpu::pageFlipHandler might've been corrupted or freed due to the pageflip timeouts then used in KWin::DrmGpu::presentationClock. Should I report this problem to Kernel Bugzilla or some other kernel mailing list? Thanks.
Comment 4 Matt Fagnani 2024-10-05 17:00:16 UTC
I had set the Dim automatically to 30 seconds and Turn off screen to 1 minute in Power Management in System Settings before the times when the problem didn't happen. Lock screen automatically was 5 minutes as default in Screen Locking in System Settings. I reproduced the crash with Plasma 6.2.0 by setting Dim automatically to 30 seconds and Turn off screen to 1 minute in Power Management in System Settings  and Lock screen automatically to 1 minute and leaving the VM idle for a minute. The VM screen shut off, I moved the mouse and the lock screen was shown for about a second, then Plasma appeared with the drkonqi showing the kwin crash with the same kind of trace. So the lock screen might need to be shown after the screen shut off for the problem to happen.
Comment 5 Vlad Zahorodnii 2024-10-07 14:41:41 UTC
Okay, I will try to reproduce it by following those steps
Comment 6 Vlad Zahorodnii 2024-10-07 15:15:48 UTC
I can't reproduce the crash, unfortunately
Comment 7 Vlad Zahorodnii 2024-10-07 15:17:01 UTC
From the sentry bug report, it's interesting to see "kwin_wayland_drm: atomic commit failed: Invalid argument" in the logs.
Comment 8 Matt Fagnani 2024-10-08 00:58:17 UTC
(In reply to Vlad Zahorodnii from comment #7)
> From the sentry bug report, it's interesting to see "kwin_wayland_drm:
> atomic commit failed: Invalid argument" in the logs.

I reproduced the problem again with Plasma 6.2.0 with Lock screen set to 1 minute and Shut off screen set to 1 minute and submitted with drkonqi as an automatic report which is what you might have referred to. The journal in the 1-2 m before the four crashes of this type showed "kwin_wayland_wrapper[3539]: waiting got error - 16, slow gpu or hang?" then "kwin_wayland_drm: Pageflip timed out! This is a kernel bug" repeatedly with "kwin_wayland_drm: No drm events for gpu "/dev/dri/card1" within last 30 seconds" once. "kwin_wayland_drm: atomic commit failed: Invalid argument" was the last error before the crash in that automatic report I made, but it wasn't shown before the other three crashes. The pageflips timeouts and gpu errors might need to happen enough times when the screen turned off and on and the lock screen appeared. Then the gpu pointer in KWin::DrmGpu::pageFlipHandler might've been invalid so that when it was dereferenced by std::chrono::nanoseconds timestamp = convertTimestamp(gpu->presentationClock(), CLOCK_MONOTONIC, ... in it, the crash happened.

The lock screen sometimes wasn't shown after the screen shut off and turned on again when I set Lock screen set to 1 minute and Shut off screen set to 1 minute, so for reproducing the problem might be more likely if one sets the lock screen time to be shorter than the Shut off screen time as is default so that the lock screen definitely has time to start first. So I set Lock screen set to 1 minute and Shut off screen set to 2 minutes, and reproduced the problem as before. I submitted an automatic report for that crash also. I didn't see this crash in VMs with 3D acceleration disabled using the llvmpipe mesa driver and virtio-gpu kernel driver, or on bare metal with radeonsi mesa driver and amdgpu kernel driver. So the problem might be specific to the virgl and virtio-gpu combination. Thanks.
Comment 9 Vlad Zahorodnii 2024-10-08 09:52:06 UTC
I've enabled hardware acceleration too. I see no kwin warnings at all when the screen is turned off.
Comment 10 Vlad Zahorodnii 2024-10-08 09:55:39 UTC
I do notice that the screen is not turned off completely though, i.e. sometimes it's dim after 2 minutes
Comment 11 Matt Fagnani 2024-10-08 14:42:28 UTC
(In reply to Vlad Zahorodnii from comment #10)
> I do notice that the screen is not turned off completely though, i.e.
> sometimes it's dim after 2 minutes

I saw the kwin crashes about 30-50% of the time after the VM screen turned off and there were messages like Display not connected on a black screen in GNOME Boxes, then I moved the mouse over the VM screen and the lock screen was briefly shown and Plasma was shown with drkonqi handling the kwin crash. If the VM's screen didn't shut off completely like that, the problem didn't usually happen. I reproduced the crash again and "kwin_wayland_drm: atomic commit failed: Invalid argument" was the last error before the crash. I'll submit the automatic report. There were lock screen journal errors like "kscreenlocker_greet[4594]: Failed to write to the pipe: Bad file descriptor." at times. The screen remained dim incorrectly after the kwin crashes. Given that the kwin and gpu errors/warnings in the journal started appearing 1-2 min before the crashes, they might be related to the automatic dimming which I had set to 30 s for the last 3 kwin crashes I saw. Sometimes the kwin and gpu journal errors were shown, but kwin didn't crash.  I think the virgl driver passes OpenGL calls to the GPU, so there might be differences based on the GPU and its drivers. My system has an AMD A10-9620P CPU with integrated Radeon R5 GPU made in 2017. Thanks.
Comment 12 Matt Fagnani 2024-10-09 03:19:18 UTC
The VM's screen might've been more likely to shut off automatically when I minimized GNOME Boxes, then left it idle at least for the Turn off screen time in System Settings, maximized it again, and moved the cursor over its screen. The kwin crash might be more frequent when doing that.
Comment 13 TraceyC 2024-10-11 21:02:21 UTC
I tested on git-master Wayland using the settings in comment 4:
Dim automatically to 30 seconds 
Turn off screen to 1 minute in Power Management in System Settings  
Lock screen automatically to 1 minute and leaving the system idle for a minute. 

I let the screen dim and then shut off quite a few times over several hours but
I wasn't able to reproduce the crash.
Comment 14 David Edmundson 2024-11-13 11:21:52 UTC

*** This bug has been marked as a duplicate of bug 496015 ***