Bug 451847

Summary: Wayland: kded5 crashed on login
Product: [Plasma] KScreen Reporter: Lyubomir <liubomirwm>
Component: kdedAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: a.samirh78, aleixpol, bugseforuns, kde, kdelibs-bugs, nate, nicolas.fella, postix, s.ruecker, vlad.zahorodnii
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.25

Description Lyubomir 2022-03-24 09:07:16 UTC
OBSERVED RESULT
Application: kded5 (kded5), signal: Segmentation fault
Content of s_kcrashErrorMessage: {_M_t = {<std::__uniq_ptr_impl<char, std::default_delete<char []> >> = {_M_t = std::tuple containing = {[1] = 0x0, [2] = {<No data fields>}}}, <No data fields>}}
[KCrash Handler]
#6  0x00007f8d24198f8a in QtWayland::kde_primary_output_v1::handle_primary_output(void*, kde_primary_output_v1*, char const*) (data=0x55b513665fe0, object=0x55b51365e900, output_name=0x7f8d3800856c "eDP-1") at /usr/src/debug/build/backends/kwayland/qwayland-kde-primary-output-v1.cpp:83
#7  0x00007f8d46992d4a in  () at /usr/lib/libffi.so.8
#8  0x00007f8d46992267 in  () at /usr/lib/libffi.so.8
#9  0x00007f8d469a2323 in  () at /usr/lib/libwayland-client.so.0
#10 0x00007f8d4699e5ab in  () at /usr/lib/libwayland-client.so.0
#11 0x00007f8d4699ff4c in wl_display_dispatch_queue_pending () at /usr/lib/libwayland-client.so.0
#12 0x00007f8d41bb85c6 in QtWaylandClient::QWaylandDisplay::flushRequests() (this=<optimized out>) at /usr/src/debug/qtwayland/src/client/qwaylanddisplay.cpp:253
#13 0x00007f8d457c74af in doActivate<false>(QObject*, int, void**) (sender=0x55b51307f840, signal_index=4, argv=0x7fffe627f3e0) at kernel/qobject.cpp:3898
#14 0x00007f8d457e2615 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55b51307f840, flags=...) at kernel/qeventdispatcher_glib.cpp:430
#15 0x00007f8d4578e88b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7fffe627f500, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#16 0x00007f8d45799fd7 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#17 0x00007f8d45cec432 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1867
#18 0x00007f8d4643f54a in QApplication::exec() () at kernel/qapplication.cpp:2829
#19 0x000055b5123a3a62 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kded-5.92.0/src/kded.cpp:769
[Inferior 1 (process 294800) detached]


EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.16.15-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7,6 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

ADDITIONAL INFORMATION
What I;ve noticed is that on login usually there is a notification about some progress called "akonadi_migration_agent" that shows for about 2-3 seconds, but this time it is stuck.
Comment 1 Lyubomir 2022-04-12 07:05:35 UTC
Probably a better trace?

Application: kded5 (kded5), signal: Segmentation fault
Content of s_kcrashErrorMessage: {_M_t = {<std::__uniq_ptr_impl<char, std::default_delete<char []> >> = {_M_t = std::tuple containing = {[1] = 0x0, [2] = {<No data fields>}}}, <No data fields>}}
[KCrash Handler]
#6  0x00007f7da1bf0f8a in QtWayland::kde_primary_output_v1::handle_primary_output(void*, kde_primary_output_v1*, char const*) (data=0x55aa8baabd50, object=0x55aa8ba9cd90, output_name=0x7f7db4007d4c "eDP-1") at /usr/src/debug/build/backends/kwayland/qwayland-kde-primary-output-v1.cpp:83
#7  0x00007f7dc2d74536 in ffi_call_unix64 () at ../src/x86/unix64.S:105
#8  0x00007f7dc2d71037 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:672
#9  0x00007f7dc2d805e2 in wl_closure_invoke (closure=closure@entry=0x7f7db4007c70, target=<optimized out>, target@entry=0x55aa8ba9cd90, opcode=opcode@entry=0, data=<optimized out>, flags=<optimized out>) at ../wayland-1.20.0/src/connection.c:1025
#10 0x00007f7dc2d80d73 in dispatch_event (display=0x55aa8b42c900, queue=<optimized out>, queue=<optimized out>) at ../wayland-1.20.0/src/wayland-client.c:1583
#11 0x00007f7dc2d80f8c in dispatch_queue (queue=0x55aa8b42c9d0, display=0x55aa8b42c900) at ../wayland-1.20.0/src/wayland-client.c:1729
#12 wl_display_dispatch_queue_pending (display=0x55aa8b42c900, queue=0x55aa8b42c9d0) at ../wayland-1.20.0/src/wayland-client.c:1971
#13 0x00007f7dbdf7f5b6 in QtWaylandClient::QWaylandDisplay::flushRequests() (this=<optimized out>) at /usr/src/debug/qtwayland/src/client/qwaylanddisplay.cpp:253
#14 0x00007f7dc1ba54af in doActivate<false>(QObject*, int, void**) (sender=0x55aa8b45fc20, signal_index=4, argv=0x7ffdc9166a30) at kernel/qobject.cpp:3898
#15 0x00007f7dc1bc0615 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55aa8b45fc20, flags=...) at kernel/qeventdispatcher_glib.cpp:430
#16 0x00007f7dc1b6c88b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7ffdc9166b50, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#17 0x00007f7dc1b77fd7 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#18 0x000055aa8a270a62 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kded-5.92.0/src/kded.cpp:769
[Inferior 1 (process 168335) detached]
Comment 2 David Edmundson 2022-05-04 22:18:16 UTC
*** Bug 452204 has been marked as a duplicate of this bug. ***
Comment 3 David Edmundson 2022-05-04 22:36:35 UTC
My working theory is because "WaylandPrimaryOutput" does no wl_proxy_destroy in the dtor any messages sent afterwards will get dispatched, but our wrapper is gone, so it will crash in the generated handler.
Comment 4 David Edmundson 2022-05-06 11:19:30 UTC
Git commit 167b699020ccd42e185834c490434a095b8b9d67 by David Edmundson.
Committed on 06/05/2022 at 11:19.
Pushed by davidedmundson into branch 'master'.

Delete proxy for PrimaryOutput wayland interface in destructor

When our wrapper class QtWayland::kde_primary_output_v1 gets destroyed
there is no code to delete the underlying wl_proxy object. Any events to
that proxy after our wrapper have gone will get disaptched to the
generated code which in turn will just crash.

M  +7    -0    backends/kwayland/waylandoutputmanagement.cpp
M  +1    -0    backends/kwayland/waylandoutputmanagement.h

https://invent.kde.org/plasma/libkscreen/commit/167b699020ccd42e185834c490434a095b8b9d67
Comment 5 Ahmad Samir 2022-05-29 10:22:09 UTC
*** Bug 454362 has been marked as a duplicate of this bug. ***
Comment 6 Nicolas Fella 2022-12-06 11:48:48 UTC
https://bugs.kde.org/show_bug.cgi?id=462700 has a similar crash in a recent Plasma