Bug 439615 - ksystemstats keeps crashing on every login
Summary: ksystemstats keeps crashing on every login
Status: RESOLVED FIXED
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (show other bugs)
Version: 5.22.3
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
: 440261 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-07 20:26 UTC by Martin Ottmar
Modified: 2021-07-28 12:31 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.22.4


Attachments
dump from journalctl (53.41 KB, text/plain)
2021-07-07 20:26 UTC, Martin Ottmar
Details
coredump dump (4.27 KB, text/plain)
2021-07-08 11:30 UTC, Martin Ottmar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Ottmar 2021-07-07 20:26:26 UTC
Created attachment 139928 [details]
dump from journalctl

SUMMARY
ksystemstats keeps crashing on every login or when starting manually via:
systemctl --user start plasma-ksystemstats.service

STEPS TO REPRODUCE
Just login to a new plasma session from sddm

OBSERVED RESULT
Ksystemstats coredumps few times (after some retries) and system monitor sensors are not available.

EXPECTED RESULT
Ksystemstats should start

SOFTWARE/OS VERSIONS 
Linux/KDE Plasma: 
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I'm sorry. I'm unable to distinguish since when, because of the Arch package ksystemstats was unistalled since its introduction for high cpu consumption...
Comment 1 David Redondo 2021-07-08 11:12:44 UTC
Are you able to get debug symbols for ksystemstats/build it yourself to see where exactly in the lmsensors plugin it is crashing?
Comment 2 Martin Ottmar 2021-07-08 11:30:25 UTC
Created attachment 139948 [details]
coredump dump
Comment 3 Martin Ottmar 2021-07-08 11:32:50 UTC
Hello.
Yes, it is easy in archlinux. I can provide binaries. And the full coredump too, if you tell me, how to get it from systemd... :-)
Comment 4 Martin Ottmar 2021-07-08 11:50:03 UTC
FYI:

(gdb) frame 0
#0  SensorsFeatureSensor::update (this=0x561ebef6e9c0) at /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp:142
142     in /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp
(gdb) p m_valueFeature
$1 = (const sensors_subfeature *) 0x0
Comment 5 David Redondo 2021-07-08 11:50:32 UTC
Thanks!
Comment 6 Martin Ottmar 2021-07-08 11:52:27 UTC
You're welcome!
Comment 7 Martin Ottmar 2021-07-08 12:42:23 UTC
(Damned procrastination!)

(gdb) p *this->m_chipName
$3 = {prefix = 0x561ebee811a0 "fam15h_power", bus = {type = 2, nr = 0}, addr = 196, path = 0x561ebee811c0 "/sys/class/hwmon/hwmon4"}
...

Thread 1 "ksystemstats" hit Breakpoint 1, makeSensorsFeatureSensor (chipName=0x5555555a7e90, feature=0x5555555b0300, parent=0x5555556809a0) at /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp:100
(gdb) p valueFeature
$1 = (const sensors_subfeature *) 0x0
(gdb) p *chipName
$2 = {prefix = 0x5555555a81a0 "fam15h_power", bus = {type = 2, nr = 0}, addr = 196, path = 0x5555555a81c0 "/sys/class/hwmon/hwmon4"}
(gdb) p *feature
$3 = {name = 0x5555555b0320 "power1", number = 0, type = SENSORS_FEATURE_POWER, first_subfeature = 0, padding1 = 0}

lm_sensors-3.6.0.r41.g31d1f125-1 (without debug symbols, of course :-/ )
Comment 8 David Redondo 2021-07-08 12:47:08 UTC
So I assume this returned nullptr https://invent.kde.org/plasma/ksystemstats/-/blob/master/plugins/lmsensors/SensorsFeatureSensor.cpp#L99

We should test if we have found a valueFeature below the switch. Wanna submit a merge request for it, since you did the investigation?

Out of interest could you paste the output of sensors on your system?
Comment 9 Martin Ottmar 2021-07-08 13:15:13 UTC
As You can see above, the valueFeature is NULL on the next line after sensors_get_subfeature(). And I can't see anything what would fill it later. But to be sure:

(gdb) br 121
Breakpoint 3 at 0x7ffff2a01c41: file /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp, line 121.
(gdb) c
Continuing.

Thread 1 "ksystemstats" hit Breakpoint 2, makeSensorsFeatureSensor (chipName=0x5555555a7e90, feature=0x5555555b0300, parent=0x5555556809a0) at /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp:121
121     in /usr/src/debug/ksystemstats-5.22.3/plugins/lmsensors/SensorsFeatureSensor.cpp
(gdb) p valueFeature
$4 = (const sensors_subfeature *) 0x0
Comment 10 Martin Ottmar 2021-07-08 13:21:08 UTC
I don't understand, what is the meaning of the "submit a merge request". I'm sorry, I'm not a KDE programmer nor a community programmer. And I'm fighting with the English language too! :-o
Comment 11 Martin Ottmar 2021-07-08 13:22:28 UTC
Is this enough, or do You know a better way?

# sensors -u
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:
  temp1_input: 51.000

fam15h_power-pci-00c4
Adapter: PCI adapter
power1:
  power1_average: 0.000
  power1_crit: 14.961
  power1_average_interval: 0.010

BAT0-acpi-0
Adapter: ACPI interface
in0:
  in0_input: 16.398

amdgpu-pci-0100
Adapter: PCI adapter
vddgfx:
  in0_input: 0.806
edge:
  temp1_input: 56.000
  temp1_crit: 104000.000
  temp1_crit_hyst: -273.150
power1:
  power1_average: 2774.162
  power1_cap: 35.000

k10temp-pci-00c3
Adapter: PCI adapter
temp1:
  temp1_input: 58.000
  temp1_max: 70.000
  temp1_crit: 95.000
  temp1_crit_hyst: 90.000

radeon-pci-0008
Adapter: PCI adapter
temp1:
  temp1_input: 58.000
  temp1_crit: 120.000
  temp1_crit_hyst: 90.000

acpitz-acpi-0
Adapter: ACPI interface
temp1:
  temp1_input: 58.000
  temp1_crit: 255.000
Comment 12 David Redondo 2021-07-08 13:32:26 UTC
> I don't understand, what is the meaning of the "submit a merge request"
Basically if you want to submit a fix for this crash :)

>fam15h_power-pci-00c4
>Adapter: PCI adapter
>power1:
>  power1_average: 0.000
>  power1_crit: 14.961
>  power1_average_interval: 0.010

It indeed has no power1_input, interesting (the same for the one from amdgpu)
Comment 13 Martin Ottmar 2021-07-08 13:44:11 UTC
Thanks for the explanation! No, thanks for that offer very much, but I'm just the reporter here, you're the programmer! I want to have this problem fixed and I will help You as much as I can do... But no any commits from my side! :-D
Comment 14 Bug Janitor Service 2021-07-09 12:37:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/8
Comment 15 David Redondo 2021-07-15 13:44:58 UTC
Git commit 70550a94e1752a8adad577574ab3b051088f5a61 by David Redondo.
Committed on 09/07/2021 at 12:36.
Pushed by davidre into branch 'master'.

Don't crash if there's no input subfeature

Apaprently not all sensors have an "input" subfeature for example
some can only have an "average" subfeature.
FIXED-IN:5.22.4

M  +4    -0    plugins/lmsensors/SensorsFeatureSensor.cpp

https://invent.kde.org/plasma/ksystemstats/commit/70550a94e1752a8adad577574ab3b051088f5a61
Comment 16 David Redondo 2021-07-15 13:45:33 UTC
Git commit 782dbe81acaa3d364d12c1e42e44fc90c447df22 by David Redondo.
Committed on 15/07/2021 at 13:45.
Pushed by davidre into branch 'Plasma/5.22'.

Don't crash if there's no input subfeature

Apaprently not all sensors have an "input" subfeature for example
some can only have an "average" subfeature.
FIXED-IN:5.22.4


(cherry picked from commit 70550a94e1752a8adad577574ab3b051088f5a61)

M  +4    -0    plugins/lmsensors/SensorsFeatureSensor.cpp

https://invent.kde.org/plasma/ksystemstats/commit/782dbe81acaa3d364d12c1e42e44fc90c447df22
Comment 17 David Redondo 2021-07-28 12:31:12 UTC
*** Bug 440261 has been marked as a duplicate of this bug. ***