Bug 478838

Summary: Plasmashell sometimes crashes in QPlatformWindow::hasPendingUpdateRequest() after or during screen being turned off
Product: [Plasma] plasmashell Reporter: Akseli Lahtinen <akselmo>
Component: generic-crashAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: crash CC: 7c6s4b+cc6efdty3btf0, agurenko, andrej.halv, enricobe, fanzhuyifan, kde.podagric, kde, kde, kdedev, kode54, nate, nicolas.fella, ua_bugz_kde
Priority: NOR Keywords: qt6, wayland
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=478990
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: plasmashell backtrace

Description Akseli Lahtinen 2023-12-21 13:56:36 UTC
SUMMARY

Sometimes plasmashell crashes when screen is turned off, either by waiting or by running kscreen-doctor -d off

STEPS TO REPRODUCE
1. Wait or turn off screen with kscreen-doctor -d off
2. Wait few minutes
3. Shake your mouse

OBSERVED RESULT
Plasmashell has crashed and restarts after screen waking up


EXPECTED RESULT
No crashes

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 39
KDE Plasma Version: 5.91.90
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.0
Kernel Version: 6.6.6-200.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
ADDITIONAL INFORMATION


BACKTRACE:
Thread 1 "plasmashell" received signal SIGSEGV, Segmentation fault.
0x00007ffff4448036 in QPlatformWindow::hasPendingUpdateRequest (this=<optimized out>)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/gui/kernel/qplatformwindow.cpp:765
Downloading source file /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/gui/kernel/qplatformwindow.cpp
765         return qt_window_private(window())->updateRequestPending;
(gdb) bt
#0  0x00007ffff4448036 in QPlatformWindow::hasPendingUpdateRequest (this=<optimized out>)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/gui/kernel/qplatformwindow.cpp:765
#1  0x00007ffff530a21a in operator() (__closure=0x37df980)
    at /usr/src/debug/qt6-qtwayland-6.6.0-1.fc39.x86_64/src/client/qwaylandwindow.cpp:1595
#2  QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()> >::call (arg=<optimized out>, f=...)
    at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137
#3  QtPrivate::Functor<QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...)
    at /usr/include/qt6/QtCore/qobjectdefs_impl.h:339
#4  QtPrivate::QCallableObject<QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=<optimized out>, this_=0x37df970, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:522
#5  0x00007ffff3bf3617 in QObject::event (this=0x3bf3820, e=0x1720800)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qobject.cpp:1437
#6  0x00007ffff65c2b38 in QApplicationPrivate::notify_helper
    (this=<optimized out>, receiver=0x3bf3820, e=0x1720800)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/widgets/kernel/qapplication.cpp:3290
#7  0x00007ffff3ba0ba8 in QCoreApplication::notifyInternal2
    (receiver=0x3bf3820, event=0x1720800)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qcoreapplication.cpp:1118
#8  0x00007ffff3ba0dad in QCoreApplication::sendEvent
    (receiver=<optimized out>, event=<optimized out>)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qcoreapplication.cpp:1536
#9  0x00007ffff3ba4aa5 in QCoreApplicationPrivate::sendPostedEvents
    (receiver=0x0, event_type=0, data=0x5a6230)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qcoreapplication.cpp:1898
#10 0x00007ffff3ba4e1d in QCoreApplication::sendPostedEvents
    (receiver=<optimized out>, event_type=<optimized out>)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qcoreapplication.cpp:1757
#11 0x00007ffff3e410bf in postEventSourceDispatch (s=0x6a46d0)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:243
#12 0x00007ffff2511e5c in g_main_dispatch (context=0x7fffdc000ef0) at ../glib/gmain.c:3476
#13 g_main_context_dispatch_unlocked (context=0x7fffdc000ef0) at ../glib/gmain.c:4284
#14 0x00007ffff256cf18 in g_main_context_iterate_unlocked.isra.0
    (context=context@entry=0x7fffdc000ef0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4349
#15 0x00007ffff250fad3 in g_main_context_iteration (context=0x7fffdc000ef0, may_block=1)
    at ../glib/gmain.c:4414
#16 0x00007ffff3e4096f in QEventDispatcherGlib::processEvents (this=0x5d4be0, flags=...)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#17 0x00007ffff3bad9bb in QEventLoop::exec (this=this@entry=0x7fffffffca90, flags=...,
    flags@entry=...)
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/global/qflags.h:34
#18 0x00007ffff3ba97bd in QCoreApplication::exec ()
    at /usr/src/debug/qt6-qtbase-6.6.0-6.fc39.x86_64/src/corelib/global/qflags.h:74
#19 0x0000000000442870 in main (argc=2, argv=0x7fffffffd718)
    at /home/akseli/Repositories/kde/src/plasma-workspace/shell/main.cpp:214
Comment 1 Nate Graham 2023-12-21 20:02:00 UTC
Single screen or multi-screen? Or both?
Comment 2 Podagric 2023-12-21 20:44:28 UTC
I can confirm that it happens to me too. Single screen.

Operating System: Arch Linux 
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7.0
Kernel Version: 6.6.7-1-clear (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-4790 CPU @ 3.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 3 Akseli Lahtinen 2023-12-22 10:41:55 UTC
Single screen in my case.
Comment 4 Nicolas Fella 2023-12-23 15:13:57 UTC
*** Bug 478932 has been marked as a duplicate of this bug. ***
Comment 5 Nicolas Fella 2023-12-23 15:14:20 UTC
*** Bug 478412 has been marked as a duplicate of this bug. ***
Comment 6 Andrej Halveland 2023-12-25 10:29:46 UTC
I basically get the exact same backtrace from plasmashell when I disconnect my external HDMI monitor. If it makes any difference the external monitor is connected via a VGA to HDMI adapter to my laptop.

This is on Arch with the kde-unstable repo enabled.
Plasma 6 Beta 2

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7.0 (beta)
Kernel Version: 6.7.0-rc6
Graphics Platform: Wayland
Graphics Drivers: mesa 23.3.1-1
Processors: AMD Ryzen 9 4900HS
Memory:  24GB of RAM
Graphics Processor: Integrated: Vega 8
Manufacturer: ASUS (Zephyrus G15 GA502IV)
Comment 7 Andrej Halveland 2023-12-25 10:30:28 UTC
Created attachment 164435 [details]
plasmashell backtrace
Comment 8 fanzhuyifan 2024-01-04 23:18:16 UTC
Marking as confirmed from the number of duplicate reports
Comment 9 fanzhuyifan 2024-01-10 17:05:56 UTC
Looking at the backtrace, does this seem like a issue caused by deleting a QObject in the event loop instead of calling deleteLater()?
Comment 10 Akseli Lahtinen 2024-01-11 15:19:39 UTC
I tested this today with Qt 6.6. branch with newest changes. The issue went away for me. I will also test with Qt 6.7.
Comment 11 fanzhuyifan 2024-01-11 16:53:29 UTC
I still get crashes with this backtrace when I rearrange multiple displays, on both neon unstable, and arch compiled from source with qt6.7. So this shouldn't be a issue of qt 6.7.
Comment 12 fanzhuyifan 2024-01-15 16:12:53 UTC
For the info I have two panels on each of my displays. The top one is always visible, and the bottom one is dodge windows. Both are non-floating. I am still reproducing when I rearrange displays on latest neon unstable.
Comment 13 Akseli Lahtinen 2024-03-07 15:59:50 UTC
*** Bug 482661 has been marked as a duplicate of this bug. ***
Comment 14 Christopher Snowhill 2024-04-13 04:51:19 UTC
Confirmed crash on Arch packaged Plasma Wayland. Two monitors: LG 24UD58-B, which disconnects itself momentarily when it's resumed from DPMS off, whether HDMI or DisplayPort; and a Dell P2414H, which maintains a steady connection regardless of DPMS state, connected by DisplayPort, as it has no HDMI inputs.

Backtrace, resolved with debuginfod as best I could:

```
#0  __pthread_kill_implementation
    (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f17380ab393 in __pthread_kill_internal (signo=11, threadid=<optimized out>)
    at pthread_kill.c:78
#2  0x00007f173805a6c8 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3  0x00007f173aed943f in KCrash::defaultCrashHandler (sig=11)
    at /usr/src/debug/kcrash/kcrash-6.0.0/src/kcrash.cpp:586
#4  0x00007f173805a770 in <signal handler called> () at /usr/lib/libc.so.6
#5  0x00007f1738db4245 in QPlatformWindow::hasPendingUpdateRequest (this=0x56c294528500)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/gui/kernel/qplatformwindow.cpp:765
#6  0x00007f173abf1acb in operator() (__closure=0x56c295ede0f0)
    at /usr/src/debug/qt6-wayland/qtwayland-everywhere-src-6.7.0/src/client/qwaylandwindow.cpp:1648
#7  QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()> >::call (arg=<optimized out>, f=...)
    at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137
#8  QtPrivate::FunctorCallable<QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()> >::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...)
    at /usr/include/qt6/QtCore/qobjectdefs_impl.h:345
#9  QtPrivate::QCallableObject<QtWaylandClient::QWaylandWindow::requestUpdate()::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=<optimized out>, this_=0x56c295ede0e0, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:555
#10 0x00007f17387883e4 in QObject::event (this=0x56c2945284f0, e=0x56c294020930)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qobject.cpp:1446
#11 0x00007f173a4fbfcb in QApplicationPrivate::notify_helper
    (this=<optimized out>, receiver=0x56c2945284f0, e=0x56c294020930)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/widgets/kernel/qapplication.cpp:3287
#12 0x00007f173873dae8 in QCoreApplication::notifyInternal2
    (receiver=0x56c2945284f0, event=event@entry=0x56c294020930)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1134
#13 0x00007f173873de74 in QCoreApplication::sendEvent
    (event=0x56c294020930, receiver=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1575
#14 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x56c28fd34ba0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1932
#15 0x00007f17389860e4 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1789
#16 postEventSourceDispatch (s=0x56c28fd62a90)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#17 0x00007f17372cf199 in g_main_dispatch (context=0x7f172c000f00) at ../glib/glib/gmain.c:3344
#18 0x00007f173732e3bf in g_main_context_dispatch_unlocked (context=0x7f172c000f00)
    at ../glib/glib/gmain.c:4152
#19 g_main_context_iterate_unlocked.isra.0
    (context=context@entry=0x7f172c000f00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4217
#20 0x00007f17372ce712 in g_main_context_iteration (context=0x7f172c000f00, may_block=1)
    at ../glib/glib/gmain.c:4282
#21 0x00007f1738983df4 in QEventDispatcherGlib::processEvents (this=0x56c28ffb8620, flags=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#22 0x00007f1738745c7e in QEventLoop::processEvents (flags=..., this=0x7fff594a6750)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventloop.cpp:100
#23 QEventLoop::exec (this=0x7fff594a6750, flags=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventloop.cpp:182
#24 0x00007f17387416e8 in QCoreApplication::exec ()
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/corelib/global/qflags.h:74
#25 0x00007f173a4f851a in QApplication::exec ()
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.7.0/src/widgets/kernel/qapplication.cpp:2555
#26 0x000056c28e3e7476 in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/plasma-workspace/plasma-workspace-6.0.3/shell/main.cpp:214
```