Bug 453242

Summary: kded5 keeps crashing in LocationUpdater::resetLocator() after upgrade
Product: [Plasma] plasmashell Reporter: Kamil Dudka <kdudka>
Component: Night ColorAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED NOT A BUG    
Severity: crash CC: alexander.lohnau, bharadwaj.raju777, contactbay, nate
Priority: NOR Keywords: regression
Version: 5.24.4   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Kamil Dudka 2022-04-30 19:45:18 UTC
STEPS TO REPRODUCE
1. I updated my  Gentoo Linux machines with KDE to latest stable versions of everything.

OBSERVED RESULT
Suddenly nm-applet stopped working and kded5 keeps crashing approx. once per second:
Apr 30 21:38:18 b360 kded5[72702]: Installing the delayed initialization callback.
Apr 30 21:38:18 b360 NetworkManager[2047]: <info>  [1651347498.1476] agent-manager: agent[9abe7988027e87ba,:1.1684/org.kde.plasma.networkmanagement/1026]: agent registered
Apr 30 21:38:18 b360 systemd-coredump[72705]: elfutils disabled, parsing ELF objects not supported
Apr 30 21:38:18 b360 systemd-coredump[72705]: [🡕] Process 72675 (kded5) of user 1026 dumped core.
Apr 30 21:38:18 b360 systemd[1]: systemd-coredump@1617-72703-0.service: Deactivated successfully.
Apr 30 21:38:18 b360 kded5[72702]: kcm_touchpad: Using X11 backend
Apr 30 21:38:18 b360 kded5[72702]: kf.config.core: Use of KConfigWatcher without DBus support. You will not receive updates
Apr 30 21:38:19 b360 systemd[1]: Started Process Core Dump (PID 72728/UID 0).
Apr 30 21:38:19 b360 systemd-coredump[72730]: Removed old coredump core.kded5.1026.d127f538c70549308c91f1781604c632.5497.1651342781000000.zst.

EXPECTED RESULT
No crashes after update to stable release.

SOFTWARE/OS VERSIONS
Linux: 5.15.32-gentoo-r1-x86_64
KDE Plasma Version: 5.24.4
KDE Frameworks Version:  5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
(gdb) bt
#0  0x00007fe9d156a06c in  () at /lib64/libc.so.6
#1  0x00007fe9d151e792 in raise () at /lib64/libc.so.6
#2  0x00007fe9d256985c in KCrash::defaultCrashHandler(int) () at /usr/lib64/libKF5Crash.so.5
#3  0x00007fe9d151e830 in <signal handler called> () at /lib64/libc.so.6
#4  KConfigBase::isGroupImmutable(QByteArray const&) const (this=0x0, aGroup=...) at /var/tmp/portage/kde-frameworks/kconfig-5.92.0/work/kconfig-5.92.0/src/core/kconfigbase.cpp:78
#5  0x00007fe9d1f175f8 in KConfigGroupPrivate::KConfigGroupPrivate(QExplicitlySharedDataPointer<KSharedConfig> const&, QByteArray const&) (name=..., owner=..., this=0x563740d6fe80)
    at /usr/include/qt5/QtCore/qshareddata.h:161
#6  KConfigGroup::KConfigGroup(QExplicitlySharedDataPointer<KSharedConfig> const&, QString const&) (this=this@entry=0x7ffefe2c2c30, master=..., _group=...)
    at /var/tmp/portage/kde-frameworks/kconfig-5.92.0/work/kconfig-5.92.0/src/core/kconfiggroup.cpp:491
#7  0x00007fe9c4012764 in LocationUpdater::resetLocator() (this=0x563740d58cf0)
    at /var/tmp/portage/kde-plasma/plasma-workspace-5.24.4/work/plasma-workspace-5.24.4/libcolorcorrect/kded/locationupdater.cpp:28
#8  0x00007fe9c4012ffa in KPluginFactory::createInstance<LocationUpdater, QObject>(QWidget*, QObject*, QList<QVariant> const&)
    (parentWidget=<optimized out>, parent=<optimized out>, args=...) at /usr/include/KF5/KCoreAddons/kpluginfactory.h:875
#9  0x00007fe9d1e99272 in KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) (this=
    0x563740cc8150, iface=0x7fe9d2586360 "KDEDModule", parentWidget=0x0, parent=0x563740af2930, args=..., keyword=...)
    at /var/tmp/portage/kde-frameworks/kcoreaddons-5.92.0/work/kcoreaddons-5.92.0/src/lib/plugin/kpluginfactory.cpp:232
#10 0x000056374098a0c0 in  ()
#11 0x000056374098d0b2 in  ()
#12 0x000056374098d443 in  ()
#13 0x000056374098712a in  ()
#14 0x00007fe9d150a2fa in  () at /lib64/libc.so.6
#15 0x00007fe9d150a3a8 in __libc_start_main () at /lib64/libc.so.6
#16 0x0000563740987541 in  ()

I do not need NightColor.  If I comment out the body of LocationUpdater::resetLocator(), kded5 no longer crashes and everything seems to work as expected.
Comment 1 Kamil Dudka 2022-04-30 19:59:17 UTC
The cause is similar to bug #423864 comment #4: m_configWatcher->config() for some reason returns nullptr.
Comment 2 Nate Graham 2022-05-13 14:55:25 UTC
*** Bug 453734 has been marked as a duplicate of this bug. ***
Comment 3 Alexander Lohnau 2022-05-14 10:22:41 UTC
Please attach your ~/.config/kwinrc file, then we can check how the code behaves with your config file and see if the issue can be reproduced.

On my system and kdesrc-build setups, it works as expected without crashing.
Comment 4 raguse 2022-05-14 11:21:59 UTC
Not having the exact same problem as mentioned in this report since I don't have nm-applet installed but as I mentioned in bug report 453734 there seems to be an issue with location service. 
When I run command 'kded5 --replace' it gives:
kf.coreaddons: "Could not load plugin from /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so: Cannot load library /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so: (libgps.so.29: cannot open shared object file: No such file or directory)"
Hence night color location service does not work.
Comment 5 Alexander Lohnau 2022-05-14 12:18:43 UTC
@raguse Do you experience any crash though?
Comment 6 raguse 2022-05-14 12:23:14 UTC
(In reply to Alexander Lohnau from comment #5)
> @raguse Do you experience any crash though?

No, no crash at all at the frontend (plasmashell). I haven't check logs systematically but I get the repeated error with kded5 --replace or also kcmshell5 kcm_nightcolor. Like said, I don't have nm-applet installed.
Comment 7 raguse 2022-05-14 12:45:45 UTC
(In reply to raguse from comment #6)
> (In reply to Alexander Lohnau from comment #5)
> > @raguse Do you experience any crash though?
> 
> No, no crash at all at the frontend (plasmashell). I haven't check logs
> systematically but I get the repeated error with kded5 --replace or also
> kcmshell5 kcm_nightcolor. Like said, I don't have nm-applet installed.

So I just compared to a virtual machine installation that runs the same OS like I have on my machine but with Plasma 5.24.2 and Frameworks 5.91 (Qt 5.15.2) and there I get the same error as just reported but definitely the location detection service with kcm_nightcolor works. 
With Plasma 5.24.5 and FW 5.93 now I have these errors in addition:

file:///usr/lib/qt/qml/org/kde/kirigami.2/ApplicationItem.qml:151:9: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 13. Use 'sequences: [ <key> ]' to bind to all of them.
file:///usr/lib/qt/qml/org/kde/kirigami.2/ApplicationItem.qml:147:9: QML Shortcut: Shortcut: Only binding to one of multiple key bindings associated with 14. Use 'sequences: [ <key> ]' to bind to all of them.

So I don't know now where the error comes from now, Frameworks or NetworkManager.
Comment 8 Kamil Dudka 2022-05-14 14:08:19 UTC
I was observing the crashes (approx. one crash per second) on multiple machines after the update.  It did not seem related to anything specific in ~/.config/kwinrc.  On one of the machines the file has this content:

[$Version]
update_info=kwin.upd:enable-scale-effect-by-default

[Compositing]
Enabled=false
OpenGLIsUnsafe=false

[Desktops]
Id_1=80512e95-79c0-44cc-9d1d-8d0c892714de
Number=1
Rows=1


On another machine the file has this content:

[$Version]
update_info=kwin.upd:replace-scalein-with-scale,kwin.upd:port-minimizeanimation-effect-to-js,kwin.upd:port-scale-effect-to-js,kwin.upd:port-dimscreen-effect-to-js,kwin.upd:auto-bordersize,kwin.upd:animation-speed,kwin.upd:desktop-grid-click-behavior,kwin.upd:no-swap-encourage,kwin.upd:make-translucency-effect-disabled-by-default,kwin.upd:remove-flip-switch-effect,kwin.upd:remove-cover-switch-effect,kwin.upd:remove-cubeslide-effect,kwin.upd:remove-xrender-backend,kwin.upd:enable-scale-effect-by-default

[Compositing]
Enabled=false
OpenGLIsUnsafe=true

[Desktops]
Id_1=2545027f-687a-4bc2-9d8c-ad4e20f1c3b8
Number=1
Rows=1

[org.kde.kdecoration2]
BorderSize=Normal
BorderSizeAuto=false
ButtonsOnLeft=MS
ButtonsOnRight=HIAX
CloseOnDoubleClickOnMenu=false
ShowToolTips=true
library=org.kde.kwin.aurorae
theme=kwin4_decoration_qml_plastik
Comment 9 raguse 2022-05-14 15:18:00 UTC
Out of curiosity I just upgraded all NetworkManager packages within my mentioned virtual machine where night color location service is still working to the latest versions. That includes plasma-nm version 5.24-5-1, networkmanager-qt, NM version 1.36.4-1 amongst others. 

Night color location service detection still works with plasma 5.24.2 and FW 5.91. I think we can exclude NetworManager as the cause.
Comment 10 raguse 2022-05-15 11:53:40 UTC
Another update: The issue reported by me in bug report 453734 seems to be solved with Frameworks 5.94 which I just applied on an VM Arch install which was released today to the repository. I do get location information again in kcm_nightlight. 
Hopefully it is the same on my main machine with Manjaro once I get the packages in the repo. 

That leaves the issue left from kded crash as originally reported here. Hopefully it's also fixed for the reporting person.

The VM OS Info I used: 
Operating System: Arch Linux
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.17.7-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 2 × Intel® Core™ i5-4210Y CPU @ 1.50GHz
Memory: 3,8 GiB of RAM
Graphics Processor: SVGA3D; build: RELEASE; LLVM;
Comment 11 Nate Graham 2022-05-16 14:27:57 UTC
> kf.coreaddons: "Could not load plugin from /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so:
> Cannot load library /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so:
> (libgps.so.29: cannot open shared object file: No such file or directory)"
This is caused by a local installation issue: missing file, or non-recompiled library. Check your installation. Since you're on Gentoo, maybe just give everything a clean build to be safe.
Comment 12 raguse 2022-05-16 14:37:35 UTC
(In reply to Nate Graham from comment #11)
> > kf.coreaddons: "Could not load plugin from /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so:
> > Cannot load library /usr/lib/qt/plugins/plasma/geolocationprovider/plasma-geolocation-gps.so:
> > (libgps.so.29: cannot open shared object file: No such file or directory)"
> This is caused by a local installation issue: missing file, or
> non-recompiled library. Check your installation. Since you're on Gentoo,
> maybe just give everything a clean build to be safe.

@Nate I guess it's because my Notebook machine is not a GPS device. I interpret it like this. 
Anyway the location service in night color seems solved now with FW 5.94 upgrade. 
Many thanks!!
Comment 13 Kamil Dudka 2022-05-16 15:47:01 UTC
I do not think that the problem reported in comment #0 has been resolved.  Bug #453734 has obviously not much in common with the SIGSEGV captured in comment #0.  m_configWatcher->config() could hardly become nullptr due to missing plasma-geolocation-gps.so.
Comment 14 Kamil Dudka 2022-07-29 22:36:20 UTC
The problem reported in comment #0 was actually caused by bug #457285.