Bug 414733

Summary: System Load Viewer, no information
Product: [Plasma] kdeplasma-addons Reporter: Wyatt Childers <kdebugs.81do7>
Component: systemloadviewerAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, wadlax
Priority: NOR    
Version: 5.17.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: a log running the widget from the command line
Set CPUINFOBUFSIZE to 128kb

Description Wyatt Childers 2019-12-01 22:53:18 UTC
SUMMARY

After reinstalling KDE Neon, and putting a system load viewer widget on my panel, it no longer shows any information for any category, CPU, memory, swap, or cache. This is affecting the visual indicators, and additionally affecting the tooltip. In the case of the tooltip it isn't display at all; instead I just get "System load".

ADDITIONAL INFORMATION

I upgraded from a 1800X to 3950X processor, I'm not sure if the increased number of cores could somehow be related?

KSysGuard is still able to view data

If I run "/usr/bin/plasmawindowed org.kde.plasma.systemloadviewer" I get an error, which seems to be related to a missing data source:
"file:///usr/share/plasma/plasmoids/org.kde.plasma.systemloadviewer/contents/ui/SystemLoadViewer.qml:251: TypeError: Cannot read property 'value' of undefined"

This suggest to me, perhaps there's a packaging error, that the load viewer is poorly recovering from? Replacing the calculations in the QML file with a value of 0 allowed the tooltip to display, however, like the visual indicators, it then printed no values.
Comment 1 Wyatt Childers 2019-12-01 22:55:08 UTC
Created attachment 124251 [details]
a log running the widget from the command line
Comment 2 Wadlax 2020-01-01 11:31:36 UTC
I confirm, i have the same issue.
Proc Ryzen 3900x, 24 "CPUs"

KSysGuard shows CPUs load.
.

As i see in "SystemLoadViewer.qml" plasmoid use sensor "system/cores" to get cores amount and get cores load.
But i don't see this sensor in KSysGuard's Sensor Browser
.

I think the problem may be in buffer size :)

File "ksysguardd/Linux/cpuinfo.c":

Procedure "processCpuInfo" calculates cores number.

Procedure "initCpuInfo" outputs monitor "system/cores" if result of "updateCpuInfo" is good.
  ( registerMonitor( "system/cores", "integer" ... )

Function "updateCpuInfo" has a check "Internal buffer too small to read ..."
and  #define CPUINFOBUFSIZE (32 * 1024)

.

With my 24 cpus, command "cat /proc/cpuinfo > 1.txt" creates a file 35,982 bytes

I will try to patch that file (i use Gentoo) and build corrected "kde-plasma/ksysguard"
Comment 3 Wadlax 2020-01-01 11:53:05 UTC
Good, that worked :)

I have created a patch, to set buffer size to 128kb
"+#define CPUINFOBUFSIZE (128 * 1024)"

Applied via Gentoo patch system ( https://wiki.gentoo.org/wiki//etc/portage/patches )
Rebuilt kde-plasma/ksysguard
And restarted Plasma.
.

I can confirm that the problem was in buffer size.
Comment 4 Wadlax 2020-01-01 11:56:02 UTC
Created attachment 124822 [details]
Set CPUINFOBUFSIZE to 128kb

Output of command "/proc/cpuinfo" is written to a buffer with a size of CPUINFOBUFSIZE.
If there is too many processors in the system - old value of 32kb is not enough.
Comment 5 Wyatt Childers 2020-01-01 15:18:00 UTC
Nice find! Though perhaps it would be better to use a dynamically allocated buffer so this doesn't need manually fixed in the future/people with fewer CPU cores don't pay for RAM they're not using?
Comment 6 Christoph Feck 2020-01-01 19:50:42 UTC

*** This bug has been marked as a duplicate of bug 384515 ***
Comment 7 Wadlax 2020-01-02 09:31:21 UTC
Yes, it would be better.
Though i don't know Cpp so well to implement this.
So, just increased that buffer a bit. For me this will do the trick.

Weird thing is - bug 384515 was opened in 2017 and still no progress.
Afaik now KDE moves to GitLab, then (the move is done) it would be good to implement even a small buffer increase, without full rewrite.