Created attachment 141307 [details] Backtrace of the crash SUMMARY (Note: ksystemstats doesn't have its own bug component) Since https://invent.kde.org/plasma/ksystemstats/-/merge_requests/9, ksystemstats crashes at startup in GpuDevice::initialize. I assume this has to do with the discovery of GPUs which goes awry (see attached backtrace). STEPS TO REPRODUCE 1. Run ksystemstats OBSERVED RESULT ksystemstats crashes on startup EXPECTED RESULT ksystemstats should run. SOFTWARE/OS VERSIONS Linux/KDE Plasma: latest master (available in About System) KDE Plasma Version: latest master KDE Frameworks Version: latest master Qt Version: 5.15.2 + KDE patches ADDITIONAL INFORMATION sudo lshw -c display *-display description: VGA compatible controller product: Vega 10 XL/XT [Radeon RX Vega 56/64] vendor: Advanced Micro Devices, Inc. [AMD/ATI] physical id: 0 bus info: pci@0000:0b:00.0 logical name: /dev/fb0 version: c3 width: 64 bits clock: 33MHz capabilities: pm pciexpress msi vga_controller bus_master cap_list rom fb configuration: depth=32 driver=amdgpu latency=0 resolution=2560,1440 resources: irq:110 memory:e0000000-efffffff memory:f0000000-f01fffff ioport:d000(size=256) memory:f6a00000-f6a7ffff memory:c0000-dffff
Pasting inline for search #0 0x00007ffff79dffc9 in operator==(QString const&, QString const&) () from /lib64/libQt5Core.so.5 #1 0x00007ffff7ed5c39 in KSysGuard::SensorProperty::setName (this=0x7ffff7640a60 <main_arena+96>, name=...) at /usr/src/debug/libksysguard5-5.22.80git.20210904T011806~8247320-ku.38.1.x86_64/systemstats/SensorProperty.cpp:71 #2 0x00007ffff340a53b in GpuDevice::initialize (this=0x5555556de740) at /usr/src/debug/ksystemstats5-5.22.80git.20210903T113040~ede1aab-ku.22.3.x86_64/plugins/gpu/GpuDevice.cpp:49 #3 0x00007ffff340b164 in LinuxAmdGpu::initialize (this=0x5555556de740) at /usr/src/debug/ksystemstats5-5.22.80git.20210903T113040~ede1aab-ku.22.3.x86_64/plugins/gpu/LinuxAmdGpu.cpp:56 #4 0x00007ffff340c71f in LinuxBackend::start (this=0x5555556cc9e0) at /usr/src/debug/ksystemstats5-5.22.80git.20210903T113040~ede1aab-ku.22.3.x86_64/plugins/gpu/LinuxBackend.cpp:64 #5 0x00007ffff3409770 in GpuPlugin::GpuPlugin (args=..., parent=0x7fffffffd338, this=0x5555556cba90) at /usr/src/debug/ksystemstats5-5.22.80git.20210903T113040~ede1aab-ku.22.3.x86_64/plugins/gpu/GpuPlugin.cpp:44 #6 KPluginFactory::createInstance<GpuPlugin, QObject> (parentWidget=<optimized out>, parent=<optimized out>, args=...) at /usr/include/KF5/KCoreAddons/kpluginfactory.h:806
It looks like the sensor property is constructed improperly (garbage when trying to check it from gdb), but I'm not sure how to debug this further.
By sensor property I mean m_temperatureProperty in plugins/gpu/GpuDevice.cpp.
FWICT, the issue is that m_temperatureProperty and the other members are never initialized, so the check for nullptr in LinuxAmdGpu::makeSensors also fails. Does it work with the following change? diff --git a/plugins/gpu/GpuDevice.h b/plugins/gpu/GpuDevice.h index 18ddedc..1450d9f 100644 --- a/plugins/gpu/GpuDevice.h +++ b/plugins/gpu/GpuDevice.h @@ -28,7 +28,7 @@ protected: KSysGuard::SensorProperty *m_usageProperty; KSysGuard::SensorProperty *m_totalVramProperty; KSysGuard::SensorProperty *m_usedVramProperty; - KSysGuard::SensorProperty *m_temperatureProperty; + KSysGuard::SensorProperty *m_temperatureProperty = nullptr; KSysGuard::SensorProperty *m_coreFrequencyProperty; KSysGuard::SensorProperty *m_memoryFrequencyProperty; };
This at least prevents ksystemstats from crashing. There's another issue now which I'll report a separate bug for later.
It's a bit weird that we have a member in the superclass that's created in the subclass overriding the superclass creation of it. But for the design we have, the patch looks sane.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/18
Git commit 207b8960a6fcd531584283f9475081d2dcf0f4aa by David Edmundson. Committed on 06/09/2021 at 12:16. Pushed by davidedmundson into branch 'master'. [plugins/gpu] Initialise properties Properties are created in the relevant subclass via makeSensors. If an implementation fails to create an object we don't want dangling pointers. M +7 -7 plugins/gpu/GpuDevice.h https://invent.kde.org/plasma/ksystemstats/commit/207b8960a6fcd531584283f9475081d2dcf0f4aa