SUMMARY ksystemstats always crashes with segmentation fault on start. STEPS TO REPRODUCE 1. Run ksystemstats. 2. Run plasma-systemmonitor. 3. Run kstatsviewer --list. OBSERVED RESULT ksystemstats immediately crashes with sigsegv on start, every time. plasma-systemmonitor shows all empty charts in its default overview dashboard (but applications and processes do show up). `kstatsviewer --list` just hangs with no output. $ ksystemstats [1] 136376 segmentation fault (core dumped) ksystemstats $ sudo dmesg | grep ksystemstats | tail -1 [10634.070037] ksystemstats[136376]: segfault at 5567d285e976 ip 00007f7586c907f1 sp 00007ffc74e328b8 error 4 in libc-2.33.so[7f7586b3b000+16b000] $ sudo dmesg | grep ksystemstats | wc -l 118 $ gdb ksystemstats GNU gdb (Ubuntu 10.1-2ubuntu2) 10.1.90.20210411-git ... Reading symbols from ksystemstats... Reading symbols from /usr/lib/debug/.build-id/8f/5f3fbc89118665671a2e4c7bad1caba0d97066.debug... (gdb) r Starting program: /usr/bin/ksystemstats [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff3923640 (LWP 139026)] [New Thread 0x7ffff1cff640 (LWP 139027)] [Detaching after fork from child process 139029] Thread 1 "ksystemstats" received signal SIGSEGV, Segmentation fault. __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:102 102 ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory. (gdb) bt #0 __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:102 #1 0x00007ffff1d033f9 in sensors_match_chip (chip2=0x5555557ca9a0, chip1=0x55555580d7b0) at lib/access.c:46 #2 sensors_lookup_chip (name=name@entry=0x5555557ca9a0) at lib/access.c:102 #3 0x00007ffff1d0350f in __sensors_get_value (name=0x5555557ca9a0, subfeat_nr=0, depth=depth@entry=0, result=result@entry=0x7fffffffd3e8) at lib/access.c:240 #4 0x00007ffff1d03a9e in sensors_get_value (name=<optimized out>, subfeat_nr=<optimized out>, result=result@entry=0x7fffffffd3e8) at lib/access.c:282 #5 0x00007ffff1d2cdd8 in SensorsFeatureSensor::update (this=0x5555557bf180) at ./plugins/lmsensors/SensorsFeatureSensor.cpp:142 #6 0x00007ffff1d2b97d in LmSensorsPlugin::update (this=<optimized out>) at ./plugins/lmsensors/lmsensors.cpp:65 #7 0x000055555556277d in Daemon::sendFrame (this=0x7fffffffda20) at ./src/daemon.cpp:236 #8 0x00007ffff7beab0e in QtPrivate::QSlotObjectBase::call (a=0x7fffffffd5d0, r=0x7fffffffda20, this=0x5555555939c0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398 #9 doActivate<false> (sender=0x555555593930, signal_index=3, argv=argv@entry=0x7fffffffd5d0) at kernel/qobject.cpp:3886 #10 0x00007ffff7be3cb8 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7ffff7e4d2a0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffd5d0) at kernel/qobject.cpp:3946 #11 0x00007ffff7beebfe in QTimer::timeout (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205 #12 0x00007ffff7be01df in QObject::event (this=0x555555593930, e=0x7fffffffd710) at kernel/qobject.cpp:1336 #13 0x00007ffff7bb31ff in doNotify (event=0x7fffffffd710, receiver=0x555555593930) at kernel/qcoreapplication.cpp:1153 #14 QCoreApplication::notify (event=<optimized out>, receiver=<optimized out>, this=<optimized out>) at kernel/qcoreapplication.cpp:1139 #15 QCoreApplication::notifyInternal2 (receiver=0x555555593930, event=0x7fffffffd710) at kernel/qcoreapplication.cpp:1063 #16 0x00007ffff7c0b8c3 in QTimerInfoList::activateTimers (this=0x555555589380) at kernel/qtimerinfo_unix.cpp:643 #17 0x00007ffff7c0c1bc in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183 #18 0x00007ffff6b9f84b in g_main_dispatch (context=0x555555586f20) at ../../../glib/gmain.c:3337 #19 g_main_context_dispatch (context=0x555555586f20) at ../../../glib/gmain.c:4055 #20 0x00007ffff6bf2c68 in g_main_context_iterate.constprop.0 (context=context@entry=0x555555586f20, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4131 #21 0x00007ffff6b9cf83 in g_main_context_iteration (context=0x555555586f20, may_block=may_block@entry=1) at ../../../glib/gmain.c:4196 #22 0x00007ffff7c0c594 in QEventDispatcherGlib::processEvents (this=0x5555555865a0, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #23 0x00007ffff7bb1b8b in QEventLoop::exec (this=this@entry=0x7fffffffd950, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #24 0x00007ffff7bba024 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #25 0x000055555555a8b7 in main (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:29 (gdb) c Continuing. Couldn't get registers: No such process. Couldn't get registers: No such process. (gdb) [Thread 0x7ffff1cff640 (LWP 139027) exited] [Thread 0x7ffff3923640 (LWP 139026) exited] Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. q $ systemctl --user status plasma-ksystemstats.service ● plasma-ksystemstats.service - Track hardware statistics Loaded: loaded (/usr/lib/systemd/user/plasma-ksystemstats.service; static) Active: failed (Result: core-dump) since Sat 2021-05-22 21:43:38 -03; 2min 1s ago Process: 141936 ExecStart=/usr/bin/ksystemstats (code=dumped, signal=SEGV) Main PID: 141936 (code=dumped, signal=SEGV) may 22 21:43:37 max6 systemd[4477]: Starting Track hardware statistics... may 22 21:43:38 max6 systemd[4477]: Started Track hardware statistics. may 22 21:43:38 max6 systemd[4477]: plasma-ksystemstats.service: Main process exited, code=dumped, status=11/SEGV may 22 21:43:38 max6 systemd[4477]: plasma-ksystemstats.service: Failed with result 'core-dump'. may 22 21:43:38 max6 systemd[4477]: plasma-ksystemstats.service: Start request repeated too quickly. may 22 21:43:38 max6 systemd[4477]: plasma-ksystemstats.service: Failed with result 'core-dump'. may 22 21:43:38 max6 systemd[4477]: Failed to start Track hardware statistics. $ systemctl --user status plasma-plasmashell.service | head -3 ● plasma-plasmashell.service - KDE Plasma Workspace Loaded: loaded (/usr/lib/systemd/user/plasma-plasmashell.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-05-22 13:11:20 -03; 8h ago EXPECTED RESULT No crashes. System monitor and kstatsviewer should show metrics and sensors. SOFTWARE/OS VERSIONS Operating System: Ubuntu 21.04 KDE Plasma Version: 5.21.90 KDE Frameworks Version: 5.82.0 Qt Version: 5.15.2 Kernel Version: 5.11.0-17-generic (64-bit) Graphics Platform: X11 Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 31,1 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1650 with Max-Q Design/PCIe/SSE2 ADDITIONAL INFORMATION ksysguardd is running, fwiw. `sensors` working as expected, shows a long list of sensors with their current values.
seems specifoc to lmsensors
(In reply to Marco Martin from comment #1) > seems specifoc to lmsensors Indeed. Removing the lmsensors plugin from "/usr/lib/x86_64-linux-gnu/qt5/plugins/ksystemstats" unlocks both plasma-systemmonitor and kstatsviewer.
Managed to debug a locally compiled build and pinpointed the crash to sensors of type SENSORS_FEATURE_IN and SENSORS_FEATURE_CURR. So that if makeSensorsFeatureSensor() returns nullptr on those types, ksystemstats works fine with all the other sensors in my system (2 fans and a lot of temperatures). Alternatively, it also works if SensorsFeatureSensor::update() returns immediately on feature names "in0_input" or "curr1_input".
Just in case, the output of `sensors` on my laptop: $ sensors ucsi_source_psy_USBC000:001-isa-0000 Adapter: ISA adapter in0: 0.00 V (min = +0.00 V, max = +0.00 V) curr1: 3.00 A (max = +0.00 A) thinkpad-isa-0000 Adapter: ISA adapter fan1: 2477 RPM fan2: 2188 RPM temp1: +41.0°C temp2: +41.0°C temp3: +0.0°C temp4: +0.0°C temp5: +0.0°C temp6: +0.0°C temp7: +0.0°C temp8: +0.0°C temp9: +0.0°C temp10: +0.0°C temp11: +1.0°C temp12: +0.0°C temp13: +13.0°C temp14: +0.0°C temp15: +0.0°C temp16: +0.0°C coretemp-isa-0000 Adapter: ISA adapter Package id 0: +43.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +42.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +41.0°C (high = +100.0°C, crit = +100.0°C) Core 2: +42.0°C (high = +100.0°C, crit = +100.0°C) Core 3: +42.0°C (high = +100.0°C, crit = +100.0°C) Core 4: +41.0°C (high = +100.0°C, crit = +100.0°C) Core 5: +41.0°C (high = +100.0°C, crit = +100.0°C) BAT0-acpi-0 Adapter: ACPI interface in0: 16.14 V ucsi_source_psy_USBC000:002-isa-0000 Adapter: ISA adapter in0: 0.00 V (min = +0.00 V, max = +0.00 V) curr1: 0.00 A (max = +0.00 A) iwlwifi_1-virtual-0 Adapter: Virtual device temp1: +32.0°C pch_cannonlake-virtual-0 Adapter: Virtual device temp1: +46.0°C nvme-pci-0200 Adapter: PCI adapter Composite: +44.9°C (low = -5.2°C, high = +79.8°C) (crit = +84.8°C) acpitz-acpi-0 Adapter: ACPI interface temp1: +41.0°C (crit = +128.0°C)
Nice work! Would you like to submit a merge request to fix it?
(In reply to Nate Graham from comment #5) > Nice work! Would you like to submit a merge request to fix it? I'd love to, but... I don't yet understand the real issue, let alone how to fix it :) (other than the hack of just ignoring those sensor types). Will keep looking at libsensors internals for now.
Git commit 6be954add10b934f3683bc599849e0fee1da140d by David Redondo. Committed on 25/05/2021 at 07:43. Pushed by davidre into branch 'master'. Init lib sensors centrally in the daemon Initing muliple times in the same process leads to crashes. M +1 -1 autotests/CMakeLists.txt M +0 -1 plugins/cpu/linuxcpuplugin.cpp M +0 -4 plugins/lmsensors/lmsensors.cpp M +6 -0 src/CMakeLists.txt M +10 -0 src/daemon.cpp https://invent.kde.org/plasma/ksystemstats/commit/6be954add10b934f3683bc599849e0fee1da140d
Git commit be6a4b3aa80c67aacf61618293b9ec2aacf374d9 by David Redondo. Committed on 27/05/2021 at 10:06. Pushed by davidre into branch 'Plasma/5.22'. Init lib sensors centrally in the daemon Initing muliple times in the same process leads to crashes. (cherry picked from commit 6be954add10b934f3683bc599849e0fee1da140d) M +1 -1 autotests/CMakeLists.txt M +0 -1 plugins/cpu/linuxcpuplugin.cpp M +0 -4 plugins/lmsensors/lmsensors.cpp M +6 -0 src/CMakeLists.txt M +10 -0 src/daemon.cpp https://invent.kde.org/plasma/ksystemstats/commit/be6a4b3aa80c67aacf61618293b9ec2aacf374d9