Sorry for being late.Havin_it wrote:Hi belze,
Sorry to hear you're having these issues too. Just to be 100% clear: can you confirm that kglobalacceld is the process that starts hammering CPU?
The first of the bugs you joined #306352 was closed because a developer had done some work for 6.2 that they expected to solve it for at least *some* of the contributors for that *very old* bug. It didn't for me, and nobody else has responded yet - see my comment there (last before yours) as to why I didn't reopen it myself.
The other one #489840, I reported because the previous one was so old and covered too much ground between different people. It made some progress but the current diagnosis from it is that it's TigerVNC's bug. And there I get stuck because TigerVNC only support systemd.
This is why I want to see if you are definitely getting the same bug as me: because if you are, under systemd, then a TigerVNC bug report can be raised.
Code: Select all
#!/bin/sh
EXE=/usr/libexec/kglobalacceld
# High CPU level to check for
LIMIT=90
# Check this often (in seconds) for CPU spiking
STEP=8
# Check this often for CPU spike continuing
QSTEP=2
# Set this to false if you do not want a desktop notification when bonk occurs
POPUP=true
if ! which kdialog &>/dev/null; then
POPUP=false
fi
HICNT=0
while true; do
EPID=$(pidof $EXE)
if [ -z "$EPID" ]; then
sleep $STEP
continue
fi
CPU=$(top -b -n 2 -d 0.2 -p $EPID | tail -1 | awk '{print $9}'|awk -F '.' '{print $1}')
SLEEPFOR=$STEP
if [ $CPU -gt $LIMIT ]; then
if [ $((HICNT++)) -eq 0 ]; then
SLEEPFOR=$QSTEP
else
pkill -f $EXE
$POPUP && kdialog --passivepopup "Bonked $EXE at ${CPU}%" 5
sleep 1
$EXE &
HICNT=0
fi
fi
sleep $SLEEPFOR
doneCode: Select all
[Desktop Entry]
Exec=/usr/local/bin/kgabonkd
Icon=application-x-shellscript
Name=kgabonkd
Type=Application
X-KDE-AutostartScript=trueWOW this is very helpful, I'll test as soon as possible.Havin_it wrote:Don't worry, I have been on this case years now, I have developed a little patience![]()
You already commented on my KDE bug but I may do a followup just to ask advice from the dev who helped me debug it there for reporting the issue to TigerVNC.
There is some other good news from plasma-6.2: kglobalacceld can once again be made to behave itself if you kill and restart it (that hadn't been true since plasma-5). As you are doing all this remotely, you'll need a way to make this happen automatically when the Plasma session starts, so here's what I've added to do that:
1. This is a script to kill and restart kglobalacceld whenever it runs at over 90% CPU for a few seconds. I wrote it as a "daemon" (running continuously) because for me sometimes the bug can recur (like if I use xdotool). I saved it as /usr/local/bin/kgabonkd.To run it requires sys-process/procps, sys-apps/coreutils and sys-apps/gawk (which you probably already have) and kde-apps/kdialog if you want desktop notifications when it acts.Code: Select all
#!/bin/sh EXE=/usr/libexec/kglobalacceld # High CPU level to check for LIMIT=90 # Check this often (in seconds) for CPU spiking STEP=8 # Check this often for CPU spike continuing QSTEP=2 # Set this to false if you do not want a desktop notification when bonk occurs POPUP=true if ! which kdialog &>/dev/null; then POPUP=false fi HICNT=0 while true; do EPID=$(pidof $EXE) if [ -z "$EPID" ]; then sleep $STEP continue fi CPU=$(top -b -n 2 -d 0.2 -p $EPID | tail -1 | awk '{print $9}'|awk -F '.' '{print $1}') SLEEPFOR=$STEP if [ $CPU -gt $LIMIT ]; then if [ $((HICNT++)) -eq 0 ]; then SLEEPFOR=$QSTEP else pkill -f $EXE $POPUP && kdialog --passivepopup "Bonked $EXE at ${CPU}%" 5 sleep 1 $EXE & HICNT=0 fi fi sleep $SLEEPFOR done
To make it run when your Plasma session starts, create a file ~/.config/autostart/kgabonkd.desktop with this inside:Hope that's some help. It's been enough to let me return to using Plasma as my everyday VNC desktop, but obviously I'm still keen to see the bug squashed. With your input I may be a step closer to that goal.Code: Select all
[Desktop Entry] Exec=/usr/local/bin/kgabonkd Icon=application-x-shellscript Name=kgabonkd Type=Application X-KDE-AutostartScript=true
Code: Select all
└─[$]> LANG=C /bin/bash /usr/local/bin/kgabonkd
/usr/local/bin/kgabonkd: line 31: [: 0,0: integer expression expected
/usr/local/bin/kgabonkd: line 31: [: 0,0: integer expression expected
/usr/local/bin/kgabonkd: line 31: [: 0,0: integer expression expected
^C
Code: Select all
if [ $CPU -gt $LIMIT ]; then
Code: Select all
top -b -n 2 -d 0.2 -p $(pidof /usr/libexec/kglobalacceld)Code: Select all
xdotool type somethingI'm en_GB.UTF8 over 'ere. I didn't ask but wondered why @belze was prefixing with LANG=C but that doesn't alter the output for me. I barely understand how i18n/l10n works at the best of timesHu wrote:Perhaps this percentage field tries to be locale-aware, and prints 0,0 in locales where comma separates the whole and fractional parts of a number, but prints 0.0 in locales where comma is a thousands-separator and period separates the whole and fractional parts of a number. I see that OP has a location of UK, but I have dealt with enough users who set their program locale different from their country of residence that I am not going to assume OP uses a GB locale.
Code: Select all
CPU=$(top -b -n 2 -d 0.2 -p $EPID | tail -1 | awk '{print $9}' | sed s/'\W.*$'//)I'm always late, still:Havin_it wrote:Oh bother, my scripting ineptitude is showing![]()
I'm not certain but I have a feeling that the top command that gets the process's CPU usage is giving slightly different output on your system, so the commands I piped it through to isolate the number are ending up with "0,0" instead of the percentage. If you could show me output of the following command I can probably do you a fix.There's probably a tool somewhere that outputs the CPU of a process more neatly, but I don't know of it.Code: Select all
top -b -n 2 -d 0.2 -p $(pidof /usr/libexec/kglobalacceld)
I haven't started bugging TigerVNC yet. I commented again on the KDE bug, hoping to get a little more feedback from the dev who helped me there in order to help me work out what exactly I'm gonna say to TigerVNC (I followed debugging steps given but this stuff is at the edge of my understanding tbh). If no reply there in the next week or so, I'll go ahead and file a TigerVNC bug with a pointer to the KDE bug and the best summary I can muster. I'll post a link here when I've done so.
EDIT TO ADD: While commenting on the KDE bug I thought of something else that might be helpful to build the picture. You said you're using LxQt as a fallback VNC desktop; could you please install x11-misc/xdotool and try executing it in your LxQt/VNC session, to see if it has any effect? Obviously it won't show in kglobalacceld as it won't be running, but in KDE it makes the Xvnc server do something that overwhelms kglobalacceld ("flood of SocketNotifier events") - I wonder if it will have any effect on another Qt-based desktop. A simple commandline to test would be
Code: Select all
xdotool type something
Code: Select all
└─[$]> top -b -n 2 -d 0.2 -p $(pidof /usr/libexec/kglobalacceld)
top - 09:29:51 up 1 day, 9 min, 7 users, load average: 8,78, 5,20, 4,17
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
%Cpu(s): 13,6 us, 7,4 sy, 0,0 ni, 39,5 id, 39,5 wa, 0,0 hi, 0,0 si, 0,0 st
MiB Mem : 21930,6 total, 288,1 free, 6909,6 used, 15197,9 buff/cache
MiB Swap: 24575,0 total, 20501,4 free, 4073,6 used. 15021,0 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1283352 myuser 20 0 1092068 81240 67844 S 0,0 0,4 0:00.24 kglobalacceld
top - 09:29:51 up 1 day, 9 min, 7 users, load average: 8,78, 5,20, 4,17
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
%Cpu(s): 10,5 us, 4,6 sy, 0,4 ni, 40,9 id, 43,0 wa, 0,0 hi, 0,4 si, 0,0 st
MiB Mem : 21930,6 total, 288,1 free, 6909,6 used, 15197,9 buff/cache
MiB Swap: 24575,0 total, 20501,4 free, 4073,6 used. 15021,0 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1283352 myuser 20 0 1092068 81240 67844 S 0,0 0,4 0:00.24 kglobalacceld
Done. Nothing to report.Havin_it wrote: EDIT TO ADD: While commenting on the KDE bug I thought of something else that might be helpful to build the picture. You said you're using LxQt as a fallback VNC desktop; could you please install x11-misc/xdotool and try executing it in your LxQt/VNC session, to see if it has any effect? Obviously it won't show in kglobalacceld as it won't be running, but in KDE it makes the Xvnc server do something that overwhelms kglobalacceld ("flood of SocketNotifier events") - I wonder if it will have any effect on another Qt-based desktop. A simple commandline to test would be
Code: Select all
xdotool type something
Code: Select all
└─[$]> xdotool type something
something%
Alert me if they ask me something and I am not replaying for more than a couple of daysHavin_it wrote:Seasonal stuff delayed me a bitbut I have now reported this with TigerVNC:
https://github.com/TigerVNC/tigervnc/issues/1890
Code: Select all
CPU=$(top -b -n 2 -d 0.2 -p $EPID | tail -n2 | head -n1 | awk '{print $9}' | sed s/'\W.*$'//)