Bug 435991 - plasmashell crashes in SortedSystemTrayModel::lessThanSystemTray() on Wayland because of system tray
Summary: plasmashell crashes in SortedSystemTrayModel::lessThanSystemTray() on Wayland...
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: master
Platform: Other Linux
: HI crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression, wayland
Depends on:
Blocks:
 
Reported: 2021-04-21 07:24 UTC by Sefa Eyeoglu
Modified: 2021-05-05 20:28 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
listIcons.sh (855 bytes, application/x-shellscript)
2021-04-21 19:57 UTC, Konrad Materka
Details
nm -gD KSC_KWayland.so (12.40 KB, text/plain)
2021-04-22 07:52 UTC, Sefa Eyeoglu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sefa Eyeoglu 2021-04-21 07:24:31 UTC
SUMMARY
Using kdesrc-build.
plasmashell crashes *sometimes*, but often shortly after starting.

STEPS TO REPRODUCE
1. Run plasmashell on Wayland
2. Create a panel with a system tray
3. Start an application with a tray icon (? unsure about this one)

OBSERVED RESULT
plasmashell crashes

EXPECTED RESULT
duh

SOFTWARE/OS VERSIONS
Linux: Arch Linux (using kdesrc-build for Desktop as well as some applications)
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.82.0
Qt Version: Arch Linux extra/qt5-base 5.15.2+kde+r175-1

ADDITIONAL INFORMATION
Backtrace:

Core was generated by `/home/scrumplex/kde/usr/bin/plasmashell --no-respawn'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f5725b1add2 in Plasma::DataContainer::data (this=0x0) at /home/scrumplex/kde/src/frameworks/plasma-framework/src/plasma/datacontainer.cpp:32
32	    return d->data;
[Current thread is 1 (Thread 0x7f571f018ac0 (LWP 8137))]
(gdb) bt
#0  0x00007f5725b1add2 in Plasma::DataContainer::data() const (this=0x0) at /home/scrumplex/kde/src/frameworks/plasma-framework/src/plasma/datacontainer.cpp:32
#1  0x00007f5710030a00 in StatusNotifierModel::data(QModelIndex const&, int) const (this=0x55825b49b580, index=<optimized out>, role=258)
    at /home/scrumplex/kde/src/plasma/plasma-workspace/applets/systemtray/systemtraymodel.cpp:312
#2  0x00007f5710063546 in KConcatenateRowsProxyModel::data(QModelIndex const&, int) const (this=<optimized out>, index=<optimized out>, role=258) at /usr/include/qt/QtCore/qabstractitemmodel.h:75
#3  0x00007f5710033168 in SortedSystemTrayModel::lessThanSystemTray(QModelIndex const&, QModelIndex const&) const (this=0x55825b4334c0, left=..., right=...)
    at /home/scrumplex/kde/src/plasma/plasma-workspace/applets/systemtray/sortedsystemtraymodel.cpp:64
#4  0x00007f57236c3cd7 in  () at /usr/lib/libQt5Core.so.5
#5  0x00007f57236c6ad0 in  () at /usr/lib/libQt5Core.so.5
#6  0x00007f57236ca581 in  () at /usr/lib/libQt5Core.so.5
#7  0x00007f57236ce616 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f572372fa20 in  () at /usr/lib/libQt5Core.so.5
#9  0x00007f5723691d1f in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#10 0x00007f572369a5a1 in QAbstractItemModel::endInsertRows() () at /usr/lib/libQt5Core.so.5
#11 0x00007f572372fa20 in  () at /usr/lib/libQt5Core.so.5
#12 0x00007f5723691d1f in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#13 0x00007f572369a5a1 in QAbstractItemModel::endInsertRows() () at /usr/lib/libQt5Core.so.5
#14 0x00007f571003069b in StatusNotifierModel::dataUpdated(QString const&, QMap<QString, QVariant> const&) (this=0x55825b49b580, sourceName=..., data=<optimized out>)
    at /home/scrumplex/kde/src/plasma/plasma-workspace/applets/systemtray/systemtraymodel.cpp:451
#15 0x00007f572372fa20 in  () at /usr/lib/libQt5Core.so.5
#16 0x00007f5725b1a627 in Plasma::DataContainer::dataUpdated(QString const&, QMap<QString, QVariant> const&) (this=this@entry=0x55825ef36d70, _t1=..., _t2=...)
    at /home/scrumplex/kde/build/frameworks/plasma-framework/src/plasma/KF5Plasma_autogen/include/moc_datacontainer.cpp:236
#17 0x00007f5725b1ae50 in Plasma::DataContainer::checkForUpdate() (this=0x55825ef36d70) at /home/scrumplex/kde/src/frameworks/plasma-framework/src/plasma/datacontainer.cpp:325
#18 0x00007f564d0b3200 in StatusNotifierItemSource::refreshCallback(QDBusPendingCallWatcher*) (this=<optimized out>, call=0x7fffeafa2bf0)
    at /home/scrumplex/kde/src/plasma/plasma-workspace/dataengines/statusnotifieritem/statusnotifieritemsource.cpp:392
#19 0x00007f572372f9e6 in  () at /usr/lib/libQt5Core.so.5
#20 0x00007f57242579e0 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) () at /usr/lib/libQt5DBus.so.5
#21 0x00007f5723725192 in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007f572451c762 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#23 0x00007f57236f868a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#24 0x00007f57236fb183 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#25 0x00007f5723751b54 in  () at /usr/lib/libQt5Core.so.5
#26 0x00007f5721a1e02c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#27 0x00007f5721a71b59 in  () at /usr/lib/libglib-2.0.so.0
#28 0x00007f5721a1b781 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#29 0x00007f5723751191 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#30 0x00007f57236f6fec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#31 0x00007f57236ff4a4 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#32 0x000055825864f7ba in main(int, char**) (argc=<optimized out>, argv=0x7fffeafa32b0) at /home/scrumplex/kde/src/plasma/plasma-workspace/shell/main.cpp:251
Comment 1 Sefa Eyeoglu 2021-04-21 07:38:56 UTC
Additionally: If it doesn't crash, I don't have any tray icons, other than the "default" ones from plasma-workspace.

So if I start any application that should show one, there isn't one in the tray.
Comment 2 Konrad Materka 2021-04-21 19:57:25 UTC
Created attachment 137770 [details]
listIcons.sh

Can you check this patch?
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/805

For missing icons, at first look it seems unrelated, but I have a feeling that both problems (crash and missing icons) are caused by the same root cause.

When icons are missing, can you run attached script? It will list all SNI (Status Notifier Item) from DBus.
Comment 3 Nate Graham 2021-04-21 20:58:09 UTC
.
Comment 4 Sefa Eyeoglu 2021-04-21 22:59:43 UTC
I just checked my dbus and I don't even have an SNI service registered there. I then noticed that some services were popping out and back in. Looking at journalctl --user -f (i am using system startup), I saw that kded5 was crashing and restarting constantly.
I am assuming that's what would register the SNI service. The crash is related to my local build though, as it can't find a symbol in my kscreen. Maybe it wasn't rebuild with the rest of the stuff?

Anyway. I am looking into that.
Comment 5 Sefa Eyeoglu 2021-04-21 23:00:44 UTC
s/system startup/systemd startup/g on my last comment
Comment 6 Sefa Eyeoglu 2021-04-21 23:10:37 UTC
× plasma-kded.service - KDE Daemon
     Loaded: loaded (/run/user/1000/systemd/user.control/plasma-kded.service; static)
     Active: failed (Result: exit-code) since Thu 2021-04-22 01:09:25 CEST; 16s ago
    Process: 315772 ExecStart=/home/scrumplex/kde/usr/bin/kded5 (code=exited, status=127)
   Main PID: 315772 (code=exited, status=127)
        CPU: 405ms

Apr 22 01:09:25 andromeda kded5[315772]: bluedevil: Agent registered
Apr 22 01:09:25 andromeda kded5[315772]: bluedevil: Requested default Agent
Apr 22 01:09:25 andromeda kded5[315772]: Registering ":1.36/StatusNotifierItem" to system tray
Apr 22 01:09:25 andromeda kded5[315772]: Registering ":1.84/StatusNotifierItem" to system tray
Apr 22 01:09:25 andromeda kded5[315772]: Registering ":1.38/StatusNotifierItem" to system tray
Apr 22 01:09:25 andromeda kded5[315772]: bluedevil: ObexAgent registered
Apr 22 01:09:25 andromeda kded5[315772]: kscreen.kwayland: Loading Wayland backend.
Apr 22 01:09:25 andromeda kded5[315772]: /home/scrumplex/kde/usr/bin/kded5: symbol lookup error: /home/scrumplex/kde/usr/lib/plugins/kf5/kscreen/KSC_KWayland.so: undefined symbol: _ZNK8KWayland6Client12OutputDevice12capabilitiesEv
Apr 22 01:09:25 andromeda systemd[1527]: plasma-kded.service: Main process exited, code=exited, status=127/n/a
Apr 22 01:09:25 andromeda systemd[1527]: plasma-kded.service: Failed with result 'exit-code'.


I don't know what to do here. I cleared ~/kde/usr and rebuilt every component involved
Comment 7 Sefa Eyeoglu 2021-04-22 07:35:49 UTC
Reverting 680134df4ca28da30a16f2e7369d1f1013d40f26 in libkscreen fixes the issue about kded not starting. That also fixes the tray icons, as they are now shown for all apps.

This also in-turn fixes the issue in this bug report, as kded5 caused an edge case which plasmashell didn't handle.
Comment 8 Sefa Eyeoglu 2021-04-22 07:52:43 UTC
Created attachment 137788 [details]
nm -gD KSC_KWayland.so

So dumping the symbols in KSC_KWayland.so actually reveals, that they are undefined.

I don't have enough experience to tell, why they would even be undefined
Comment 9 Konrad Materka 2021-04-22 17:46:57 UTC
> This also in-turn fixes the issue in this bug report, as kded5 caused an
> edge case which plasmashell didn't handle.
Yes, crashing kded can definitely cause some weird scenarios.

> So dumping the symbols in KSC_KWayland.so actually reveals, that they are
> undefined.
Is this related?
Comment 10 Sefa Eyeoglu 2021-04-22 20:03:16 UTC
(In reply to Konrad Materka from comment #9)
> > This also in-turn fixes the issue in this bug report, as kded5 caused an
> > edge case which plasmashell didn't handle.
> Yes, crashing kded can definitely cause some weird scenarios.
> 
> > So dumping the symbols in KSC_KWayland.so actually reveals, that they are
> > undefined.
> Is this related?

I don't know tbh.
Comment 11 Vlad Zahorodnii 2021-04-23 06:22:29 UTC
symbol lookup error: /home/scrumplex/kde/usr/lib/plugins/kf5/kscreen/KSC_KWayland.so: undefined symbol: _ZNK8KWayland6Client12OutputDevice12capabilitiesEv

it looks like libkscreen was built with the right kwayland, but then kwayland was downgraded or maybe wrong kwayland is picked up.
Comment 12 Sefa Eyeoglu 2021-04-23 16:43:47 UTC
I deleted my all of my kdesrc-build environment today, including the configuration and rebuilt everything. It still fails with the same error.
Comment 13 Konrad Materka 2021-04-24 16:00:47 UTC
Do you still have problems with Sytem Tray crash? If not, can you close this bug report and open separate one for libkscreen?
Comment 14 Sefa Eyeoglu 2021-04-24 17:05:15 UTC
Yes. When kded5 is running as intended, this bug does not appear.
Comment 15 David Redondo 2021-04-30 09:29:01 UTC
*** Bug 436350 has been marked as a duplicate of this bug. ***
Comment 16 Konrad Materka 2021-05-01 19:48:45 UTC
Git commit 26f369ad7a23fb51d685438c51fec97654ca63e6 by Konrad Materka.
Committed on 01/05/2021 at 19:41.
Pushed by kmaterka into branch 'master'.

[dataengine] Emit sourceRemoved earlier

Emit `sourceRemoved` before source is actually removed, so that
visualization has a chance to disconnect itself.
Related: bug 436350, bug 436180

M  +2    -2    src/plasma/dataengine.cpp

https://invent.kde.org/frameworks/plasma-framework/commit/26f369ad7a23fb51d685438c51fec97654ca63e6
Comment 17 Bug Janitor Service 2021-05-01 19:49:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/248
Comment 18 Konrad Materka 2021-05-05 20:28:17 UTC
Git commit 5984d4960fa5ecf60a20b1fbc782fb841faa4af7 by Konrad Materka.
Committed on 04/05/2021 at 07:14.
Pushed by kmaterka into branch 'master'.

[dataengine] Emit sourceRemoved earlier

Emit `sourceRemoved` before source is actually removed, so that
visualization has a chance to disconnect itself.
Related: bug 436350, bug 436180

M  +2    -2    src/plasma/dataengine.cpp

https://invent.kde.org/frameworks/plasma-framework/commit/5984d4960fa5ecf60a20b1fbc782fb841faa4af7