Closed slartibart70 closed 5 months ago
Hi, i just tested the fix (copying the necessary files from the git repo to the installation on fc35. Sorry to say, it does not fix the problem. Even looking at your code, i don't think this really addresses the underlying bug of displaying the proper values. (i don't see anything in the commit addressing the network-interfaces, only fixes for the graph?)
Here, i need to still manually deselect the ethernet-nic in the widget config so that the network-speed graph shows values different from zero (when using wifi only)
Maybe i can help with anything to isolate the bug?
i just updated to 2.6.1 using discover, re-checking.... issue still exists (so, i did nothing wrong when manually updating the widget using git) What files/info do you need to fix this?
Oh, sorry i think i have misunderstood the problem.
After re read the issue i need some answers to be clear and sure of how i can really fix that issue :
zero
values instead of the right when you switch from ethernet
to wifi
, right ?Could you provide some debug values by following they steps :
Clone the repo
Add print(interfaces)
before this line : https://github.com/orblazer/plasma-applet-resources-monitor/blob/1c042dc395a10ee1a6f9cd36aa3c5a5713060757/package/contents/ui/components/NetworkInterfaceDetector.qml#L18
Add print(data(index(0, column), Sensors.SensorDataModel.Name))
before this line https://github.com/orblazer/plasma-applet-resources-monitor/blob/1c042dc395a10ee1a6f9cd36aa3c5a5713060757/package/contents/ui/components/NetworkGraph.qml#L56
Run the dev env :
yarn dev
npm run dev
./scripts/test.sh
Reproduce your bug by enabling network graph and switch between wifi
and ethernet
and them, paste the logs (from console) here.
Thanks by advance.
Hi,
thanks for pointing to the proper locations in the source. First, in fedora, you need to define sth like
export QT_LOGGING_RULES="*.debug=true; qt.*.debug=false"
npm run dev
so that debugging output appears on the console.
Next, i added some more console.logs to the code, esp in the Timer of NetworkGraph.qml
Timer {
id: timer
repeat: true
running: chart.visible
interval: chart.interval
onTriggered: {
chart.dataTick()
// Calculate total download
var value = 0
var dlval = 0
for (var i = 0; i < downloadSensors.length; i++) {
dlval = sensorsModel.getData(i)
if ( dlval !== undefined ) {
console.log("dl-value["+i+"]:"+ dlval)
value += dlval
}
}
value *= dialect.KiBDiff // Fix dialect
downloadSpeed.value = value
Turns out, the contents of dlval (which i added here) contains 'undefined'. In your code, you just added 'undefined' to the var 'value' ... which is not working
So, my fix above (download only) with an explicit check to 'undefined' does the trick, now i can select all network interfaces in the widgets config dialog and all is fine (that is, i get my values of the download speed in the network graph)
Maybe you can refine the code above, make it a little nicer. But, it works
So, i'm looking forward to a version 2.6.x ? :-)
as we are on it already,
what happend to the memory-option use allocated memory instead of application
?
This was available in 2.5.x, but missing in 2.6.x
I enabled the option in 2.5.x because this gave me a 'better' result for the memory used. Is this by default now enabled? Any help is appreciated
Oh yes, i have miss to exclude the undefined
values :facepalm:
The memory in 2.6.x
use the physical usage (like in System Monitor
), and with the new system i cant choose want i retrieve for memory :disappointed:
Note: for the debug, its really need QT_LOGGING_RULES
for see logs of print
/console.log
because on plasma i see the logs and if i add this env that enable QT debug.
Hi, once again... i installed 2.6.2 on another machine running fc34. I think your correction was not enough. Yes, download speed is ok, but upload speed is still suffering from the same problem. That is, disabling all (other) NIC checkboxes besides the one connected - then we also have upload speed shown in the widget. All NICs activated, and the speed stays at zero
I did not check, but this smells like the same bug, just a different (code) position Please check :-)
regarding the envVars: maybe this is a speciality of fedora, without them there is no output of print or console.log And, it's selective in the sense of allowing debug messages, but not all of 'em (qt debug msgs is disabled) Maybe we can tweak the rules even further, but for me this was enought to get the log outputs i wanted
and, just a question: in plasma-applet-resources-monitor/package/contents/ui/components/NetworkGraph.qml // Timer
value = 0
for (var i = 0; i < uploadSensors.length; i++) {
value += sensorsModel.getData(downloadSensors.length + i)
}
this is code for the upload sensors, why do you reference downloadSensors.length here if you iterate over uploadSensors.length?
Hello,
In the mentioned code is because the sensorsModel
handle both download and upload sensors but i have refactor my code for an better way.
Could you try with latest code from this repo to see if is fixed ? If not, could you add this lines :
print(sensorsModel.sensors, sensorsLength)
print(downloadValue, uploadValue)
print("")
Bellow this line : https://github.com/orblazer/plasma-applet-resources-monitor/blob/9f291d45a36eef15005ff9f1b5b91d4282747d50/package/contents/ui/components/NetworkGraph.qml#L194
I admit, i don't know precisely whats could be wrong in that case.
Thanks by advance.
Hi, i was testing with the latest master branch on two systems: the upload speed is available again.
But, another problem is here... i get zero values on my fc35 machine. fc34: the connection is using ethernet, which is the first adapter in your sensors list. Here, i get nice up/dl values fc35: the connection is using wlan, which is the second adapter in your sensors list (see below)
If on fc35 i select both adapters, then i always see zero values for up/dl. If i unselect the eth-nic, then i get meaningful up/dl values.
I assume, that there's still a problem if not the first nic is the one in charge (i.e. having traffic). To prove, i added this to NetworkGraph.qml
function _dataTick() {
...
// Calculate total download
var downloadValue = 0, uploadValue = 0
for (var i = 0; i < sensorsLength; i++) {
var value = sensorsModel.getData(i)
print("** i="+i+" data="+value)
along with your suggested prints
Result (i was refreshing a browser using the wlan-nic while printing the outputs)
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: ** i=2 data=0
qml: ** i=3 data=0
qml: [network/enp0s31f6/download,network/enp0s31f6/upload,network/wlp4s0/download,network/wlp4s0/upload] 4
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: ** i=2 data=0
qml: ** i=3 data=0
qml: [network/enp0s31f6/download,network/enp0s31f6/upload,network/wlp4s0/download,network/wlp4s0/upload] 4
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: ** i=2 data=0
qml: ** i=3 data=0
qml: [network/enp0s31f6/download,network/enp0s31f6/upload,network/wlp4s0/download,network/wlp4s0/upload] 4
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: ** i=2 data=0
qml: ** i=3 data=0
qml: [network/enp0s31f6/download,network/enp0s31f6/upload,network/wlp4s0/download,network/wlp4s0/upload] 4
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: ** i=2 data=0
qml: ** i=3 data=0
### switching to wlan only in config dialog
qml: update sensors
org.kde.libksysguard.sensors: Received metadata change for "network/wlp4s0/download"
org.kde.libksysguard.sensors: Received metadata change for "network/wlp4s0/upload"
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 0 0
qml:
qml: ** i=0 data=84
qml: ** i=1 data=140
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 86.016 143.36
qml:
qml: ** i=0 data=7224
qml: ** i=1 data=4652
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 7397.376 4763.648
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 0 0
qml:
qml: ** i=0 data=0
qml: ** i=1 data=0
qml: [network/wlp4s0/download,network/wlp4s0/upload] 2
qml: 0 0
qml:
Hum, that look really weird :confused:
Could you try to add sensors in custom page on System Monitor
(package: plasma-systemmonitor
) and look if you have the right data ?
If the data is :
libksysguard
and not from this widgetThanks.
Hi, just tested... it really seems to be the widget. The problem appears, if you manipulate the config settings of the widget. Here, i had 2 widgets running, one in taskbar, one in plasmawindowed
Both source files are identical, one living in ~/.local/share/plasma/plasmoids/org.kde.resourcesMonitor-fork/ one in ~/Develop/plasma-applet-resources-monitor/
So we have: Screenshot_20220105_134659: test dl/ul with eth connected Screenshot_20220105_134721: still testing (upload)
Screenshot_20220105_134748: disconnect eth
Screenshot_20220105_134833: test again (1) here all seems ok, i did not touch the config dialog - we still get dl/ul speeds in widget (both)
Screenshot_20220105_134908: now, i used the widget config dialog, deselected eth, then reselected it you see, the dl/ul speeds are zero The taskbar widget is still measuring, because i did not touch anything of it
Screenshot_20220105_134934: some time later, still no dl/ul data
The problem starts, when i disconnect eth (not necessarily pulling the plug, just disabling it in networks) and go into settings and disable/enable eth.
All data is available in ksysguard, and (as seen in widget in taskbar) also to RMf, but not the one i modified the configuration. Maybe the (service) listener handling is still problematic?
Ok, that is really strange,
Could you add some print here https://github.com/orblazer/plasma-applet-resources-monitor/blob/cf47a7c7ec7aa8f9ae8c1450908f176a6189d8d1/package/contents/ui/components/NetworkGraph.qml#L135 and here https://github.com/orblazer/plasma-applet-resources-monitor/blob/cf47a7c7ec7aa8f9ae8c1450908f176a6189d8d1/package/contents/ui/components/NetworkGraph.qml#L139 to see if the value is undefined
? i think the index look like wrong
Hi, sorry for the log delay. I checked, also with the most current version on fc34 and fc35. Bug still exists. And, the debug does not show any 'undefined' values.
I didn't find a way to reproduce it properly. But it happens sometimes after sleep/wakeup of the laptop, or as i already said when switching network devices (e.g. switching between ethernet and wifi) Strange thing is, sometimes it's not working, i put the laptop to sleep, and the next day it's showing network speed as expected.
What i did right now is to manually select exclusively the nic where traffic is coming in/out of the machine. All others are disabled It's a workaround, but you should definitely investigate further.
Hello,
The randomness of that bug and what cause this push me to think that come libksysguard
directly :disappointed:
I have found some issues with dynamic enable, could you try with https://github.com/orblazer/plasma-applet-resources-monitor/commit/d75e0174a4cc98abb3bf3af3043eb073fc36e524 and see if that fix ?
Is it true, that the d75e017
ist the same as the tag 2.7.1? (i could not find any differences to your modificiations with this hash)
so, i tested...
fedora34: ethernet is first in your config list (enp0s31f6), then there are wlp3s0, virbr0, wwp0s20f0u5i12 (wifi, kvm/qemu, lte modem)
Switching back to ethernet, i enable all NICs, then use network-manager to disable wlan, enable ethernet connection. All is fine, speed info is given in the applet (as it was before, i assume this is due to the fact that eth is the first in the list)
To answer your question: no change to the previous state, i would consider this still broken.
Hello, Yes is the same commit but i have fixup so the new hash is : https://github.com/orblazer/plasma-applet-resources-monitor/commit/70a42085d74e00e8d7790b423db4b1fc87a68398 I have also make an new commit so now the olf value should be no longer present (https://github.com/orblazer/plasma-applet-resources-monitor/commit/9799666adcaa1d123b9de58370fda63266b5c025)
i open config, deselect all other interfaces - one by one: first, eth (enp...): no change, then virbr0 (no change), then lte/wwp0... Now, only wlp3s0/wifi is selected, immediately with the deselect of lte/wwp.0.. the widget speed indicators come to live. No need to press the apply button.
That is because in QML we doesn't have way bind the click of Apply
button and the update of StringList
is tricky... CF: https://github.com/orblazer/plasma-applet-resources-monitor/blob/9799666adcaa1d123b9de58370fda63266b5c025/package/contents/ui/config/ConfigData.qml#L98-L112
For re resume your issue :
network interfaces
settings : only enp0s31f6
get the change and the other doesn't have the dataFor make me sure the new commits haven't change some date could you add print(column, data(index(0, column), Sensors.SensorDataModel.SensorId), value)
before this line : https://github.com/orblazer/plasma-applet-resources-monitor/blob/9799666adcaa1d123b9de58370fda63266b5c025/package/contents/ui/components/NetworkGraph.qml#L139
That should show the raw data of libksysguard
, so with that its confirm the origin of problem :
libksysguard
and i think i can't fix itThanks by advance
Hi,
i think i found the problem (i would say.. two problems)
1) test.sh Script
i wasn't using it until this testing, i stuck to npm run dev
(with exported envVars)
Your script is using PLASMOID_DIR='~/.local/share/plasma/plasmoids/'
which is a problem if you already have the plugin installed. Then, of course, the installed sources will be used, and not the git-checkout.
This is bad... but using npm run dev
will use the git-sources
I would suggest to fix this
2) In networkGraph.qml, you give up too early when looking for values - only index 0 and 1 will be used, but never later(bigger) indexes. Let me explain: my order of devices: eth, wifi (virb, lte modem is not selected) I start with wifi only, eth is disabled, so index 0/1 is wifi:
qml: total dl, i=0 length=4
qml: sensorsModel.sensors[i]=network/wlp3s0/download
qml: *** getData(): 0 network/wlp3s0/download 34586
qml: total dl, i=1 length=4
qml: sensorsModel.sensors[i]=network/wlp3s0/upload
qml: *** getData(): 1 network/wlp3s0/upload 2444
qml: total dl, i=2 length=4
qml: sensorsModel.sensors[i]=network/tun1/download
qml: total dl, i=3 length=4
qml: sensorsModel.sensors[i]=network/tun1/upload
Now, i activate eth in the settings dialog of the widget (i do not activate this nic in networkManager, though!) Now, your indexes are wrong: In this block:
184 ¦ ¦ ¦ // Calculate total download
185 ¦ ¦ ¦ var downloadValue = 0, uploadValue = 0
186 ¦ ¦ ¦ for (var i = 0; i < sensorsLength; i++) {
187 ¦ ¦ ¦ ¦ ¦ print("total dl, i="+i+" length="+sensorsLength)
188 ¦ ¦ ¦ ¦ ¦ print("sensorsModel.sensors[i]="+sensorsModel.sensors[i])
189 ¦ ¦ ¦ ¦ ¦ if (sensorsModel.sensors[i].indexOf('/download') !== -1) {
190 ¦ ¦ ¦ ¦ ¦ ¦ ¦ downloadValue += sensorsModel.getData(i)
191 ¦ ¦ ¦ ¦ ¦ } else {
192 ¦ ¦ ¦ ¦ ¦ ¦ ¦ uploadValue += sensorsModel.getData(i)
193 ¦ ¦ ¦ ¦ ¦ }
194 ¦ ¦ ¦ }
you still try to access index 0/1, but this is now the index for the eth, not the wifi any more. The result of getData() is 'undefined', which is captured, value is returned as zero and therefore the graph is zero as well.
What needed to be done was to ignore index 0 and 1 and instead getData() for wifi, which is now on index 2/3 But this never happens, see also my getData(), this never appears for index 0,1,2,3 in the last log. In the qml log above, we can find it at least for index 0,1, but after an 'undefined' we get never again into lines 137 or 140. Maybe the line 132/133 is the culprit?
131 ¦ ¦ ¦ function getData(column) {
132 ¦ ¦ ¦ ¦ ¦ if (!hasIndex(0, column)) {
133 ¦ ¦ ¦ ¦ ¦ ¦ ¦ return 0
134 ¦ ¦ ¦ ¦ ¦ }
135 ¦ ¦ ¦ ¦ ¦ var value = data(index(0, column), Sensors.SensorDataModel.Value)
136 ¦ ¦ ¦ ¦ ¦ if (typeof value === "undefined") {
137 ¦ ¦ ¦ ¦ ¦ ¦ ¦ print ("column=" + column + " value=undefined")
138 ¦ ¦ ¦ ¦ ¦ ¦ ¦ return 0
139 ¦ ¦ ¦ ¦ ¦ }
140 ¦ ¦ ¦ ¦ ¦ print("*** getData(): " + column, data(index(0, column), Sensors.SensorDataModel.SensorId), value)
141 ¦ ¦ ¦ ¦ ¦ return value
142 ¦ ¦ ¦ }
org.kde.libksysguard.sensors: Received metadata change for "network/wlp3s0/download"
org.kde.libksysguard.sensors: Received metadata change for "network/wlp3s0/upload"
qml: total dl, i=0 length=6
qml: sensorsModel.sensors[i]=network/enp0s31f6/download
qml: column=0 value=undefined
qml: total dl, i=1 length=6
qml: sensorsModel.sensors[i]=network/enp0s31f6/upload
qml: column=1 value=undefined
qml: total dl, i=2 length=6
qml: sensorsModel.sensors[i]=network/wlp3s0/download
qml: total dl, i=3 length=6
qml: sensorsModel.sensors[i]=network/wlp3s0/upload
qml: total dl, i=4 length=6
qml: sensorsModel.sensors[i]=network/tun1/download
qml: total dl, i=5 length=6
qml: sensorsModel.sensors[i]=network/tun1/upload
Can you fix this?
Thanks for your data !
For the bug in script i have fix it with https://github.com/orblazer/plasma-applet-resources-monitor/commit/9db3f597abec3a7ad6fcfb48b476af07fbb3298c
For the second i have found the origin of issue, for unknown reason we have missing register of sensors in Sensors.SensorDataModel
..
For explain that is my case (i have hardcode the sensors) :
org.kde.libksysguard.sensors: Received metadata change for "network/enp3s0/download"
org.kde.libksysguard.sensors: Received metadata change for "network/enp3s0/upload"
qml: [network/lo/download,network/lo/upload,network/enp3s0/download,network/enp3s0/upload]
qml: 0 network/lo/download undefined
qml: 1 network/lo/upload undefined
qml: 2 network/enp3s0/download NO INDEX
qml: 3 network/enp3s0/upload NO INDEX
And the strangest thinks is when i add another sensor i have :
org.kde.libksysguard.sensors: Received metadata change for "cpu/all/usage"
org.kde.libksysguard.sensors: Received metadata change for "network/enp3s0/upload"
org.kde.libksysguard.sensors: Received metadata change for "network/enp3s0/download"
qml: [network/lo/download,network/lo/upload,network/enp3s0/download,network/enp3s0/upload,cpu/all/usage]
qml: 0 network/lo/download undefined
qml: 1 network/lo/upload undefined
qml: 2 network/enp3s0/download 9258
qml: 3 network/enp3s0/upload NO INDEX
qml: 4 cpu/all/usage NO INDEX
And after a lot of try to fix that i have probably found the solution ! NOTE: that solution is not the best but i haven't knowledge to make this in C++ I have split up the sensors so now i have all values.
Tell me if an issue is still present with last commit (i edit the commit message if that definitely fix the issue).
i have tested with the current branch, not convinced yet. I also put this code into the installed plasma widget (~/.local/share/plasma/...) for further testing
I think, the switch between nics is not recorded properly. (e.g disabling eth, enabling wifi) If the webradio is receiving data using eth, then switching to wifi, disabling eth - in this moment the netspeed widget data is frozen, and never updated. Also when webradio is playing over wifi. Workaround: open config, deselect eth, deselect wifi. Press apply (this is important!!) Then select wifi again: speed meter works select eth additionally: speedmeter (still) works
I would say, a bit better, but still not bug free experience :-D
Do you know how the installed widget can be forced to reread its sources (without the need to logout/login again)? A removal of the (single) widget and putting it to the same place again was not sufficient...
going from wifi to eth: speedmeter is stuck, open config panel, deselect (selected) eth, click apply, re-select eth. Speedmeter is working again
Do you know how the installed widget can be forced to reread its sources (without the need to logout/login again)? A removal of the (single) widget and putting it to the same place again was not sufficient...
You need restart plasmashell
like i make here : https://github.com/orblazer/plasma-applet-resources-monitor/blob/9f4347906a8c6f3b85aa7047702f6b817ddd196e/scripts/real-test.sh#L15-L16
For your issue print the sensors here, but if that is right i thinks the only way to this issue should be go to make that system in C++ :disappointed: https://github.com/orblazer/plasma-applet-resources-monitor/blob/9f4347906a8c6f3b85aa7047702f6b817ddd196e/package/contents/ui/components/NetworkGraph.qml#L149
Thanks
well, let the problem fester for some time.... there should be another way to address this. :-)
just curious: didn't you fork parts of https://store.kde.org/p/998895 (netspeed widget)? I had this one previously, and i didn't encounter (as far as i remember) any of those problems. Maybe this widget could be some source of inspiration?
you said
For your issue print the sensors here, but if that is right i thinks the only way to ...
maybe i didn't understand properly: do you want me to provide some more debug output?
just curious: didn't you fork parts of https://store.kde.org/p/998895 (netspeed widget)? I had this one previously, and i didn't encounter (as far as i remember) any of those problems. Maybe this widget could be some source of inspiration?
The problem of this (and lot of similar projects) it's use ksysguard
, an deprecated apps since plasma 5.22..
maybe i didn't understand properly: do you want me to provide some more debug output?
Yes, just for sure if you still have all sensors when the data is "stuck".
But i think i need to find an way to really reproduce that issue by creating an virtual interface or something like that.
Hi, I have the exact same issue with Manjaro KDE. Do you need any kind of logs?
Same here with version 2.7.1 and Manjaro KDE. I just installed the before mentioned Netspeed Widget: when I select all 3 network interfaces I do see dl/ul rates in this widget.
Hi, same issue in Archlinux here, always show 0
Ok, I think i have progress to that issue. I have try with sharing net with my phone so i have this issue :
usb0
but widget return something like enp0s20f0u5
.usb0
to enp0s20f0u5
i never see usb0
outside of libksysguard
So for confirm things (@slartibart70 @vfauth @aluedtke7 and @hunabku94) :
v2.9.1
+) to check if that is fixed ?ip -o link show
(only 2nd column, because that also out mac address))Originally posted in #69 by @wokawoka :
Additionally, I'm experiencing the problem that if I also select the wwan interface (I often keep the 4G modem disabled in my system) the netspeed data remains at 0 kbps even if the wifi interface is exchanging data.
It only works if I deselect the wwan interface from the option, but then I can't monitor the data I exchange when I 'm on the go and I turn on the modem.
Hello, I have found the solution for this very old issue with that project https://github.com/dfaust/plasma-applet-netspeed-widget. So i think once 3.0 is released i will backport the fix to 2.11.
Sorry for very long waiting about that issue.
I just upgraded to v.2.6.0 The problem with #16 is indeed solved (nice!), but i discovered something new:
I have 2 network interfaces in the laptop,
If both of them are selected in the configuration panel, and the laptop is using only wifi, then the network speed is always zero. Workaround: manually deselect enp0s31f6 Now the network speed of the wlan is shown correctly
I would prefer the widget handling this automatically... so if one network card doesn't deliver values, take the other one (providing values). Or, just add values of all incoming connections (if, for example, eth and wlan are working at the same time)
Could you please take a look into this? Btw, the ksysguard applet shows the proper values as expected, so maybe it's just the widget?