Fix: XFCe (up to 4.10 at least): tumblerd using 100% CPU

Post tutorials, HOWTO's and other useful resources here.
Post Reply
User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Fix: XFCe (up to 4.10 at least): tumblerd using 100% CPU

Post#1 by Rava » 16 Apr 2016, 05:07

I found a solution to the tumblerd og XFCe hogging 100% CPU, especially when browsing folders with many files, especially large files e.g. animated GIF, or huge PNG or animated PNG files, for creating the thumbnails.

It is also described here.

There are two solutions I found online.
Both are scripts. The one that seems to be the "more compact coded" one is from https://wiki.archlinux.org/index.php/th ... o_much_CPU :

Code: Select all

#!/bin/bash
period=20
tumblerpath="/usr/lib/*/tumbler-1/tumblerd" # The * here should find the right one, whether 32 and 64-bit
cpu_threshold=50
mem_threshold=20
max_strikes=2                               # max number of above cpu/mem-threshold's in a row
log="/tmp/tumblerd-watcher.log"

if [[ -n "${log}" ]]; then
    cat /dev/null > "${log}"
    exec >"${log}" 2>&1
fi


strikes=0
while sleep "${period}"; do
    while read pid; do
	cpu_usage=$(ps --no-headers -o pcpu -f "${pid}"|cut -f1 -d.)
	mem_usage=$(ps --no-headers -o pmem -f "${pid}"|cut -f1 -d.)

	if [[ $cpu_usage -gt $cpu_threshold ]] || [[ $mem_usage -gt $mem_threshold ]]; then
	    echo "$(date +"%F %T") PID: $pid CPU: $cpu_usage/$cpu_threshold %cpu MEM: $mem_usage/$mem_threshold STRIKES: ${strikes} NPROCS: $(pgrep -c -f ${tumblerpath})"
	    (( strikes++ ))
	    if [[ ${strikes} -ge ${max_strikes} ]]; then
		kill "${pid}"
		echo "$(date +"%F %T") PID: $pid KILLED; NPROCS: $(pgrep -c -f ${tumblerpath})"
		strikes=0
	    fi
	else
	    strikes=0
	fi
    done < <(pgrep -f ${tumblerpath})
done
Sadly, it won't work that easily for our version / path of tumblerd;

Code: Select all

root@porteus:/# l /usr/lib/*/tumbler-1/tumblerd
ls: cannot access /usr/lib/*/tumbler-1/tumblerd: No such file or directory
root@porteus:/# l /usr/lib64/tumbler-1/tumblerd
-rwxr-xr-x 1 root 91104 2014-10-19 15:15 /usr/lib64/tumbler-1/tumblerd
root@porteus:/# l /usr/lib*/*/tumbler-1/tumblerd
ls: cannot access /usr/lib*/*/tumbler-1/tumblerd: No such file or directory
root@porteus:/# l /usr/lib*/tumbler-1/tumblerd
-rwxr-xr-x 1 root 91104 2014-10-19 15:15 /usr/lib64/tumbler-1/tumblerd

I have not run both scripts to get a good comparison, but by the code alone it seems the wiki.archlinux.org version is more "compact" or "slim-coded" and might be more CPU and RAM friendly.


The other version you can find here:
http://forums.linuxmint.com/viewtopic.p ... rd#p554241


It was posted as solution here https://forum.xfce.org/viewtopic.php?id=8722 and since I do have an forum.xfce account I did post the URL and code of the other, more slim script (as I did above)

Any ideas what the path of the 32 bit version to tumblerd is?
The "longer" version used /usr/lib/i386-linux-gnu/tumbler-1/tumblerd
But I dunno what 32 bit Porteus 3.1 (and upcoming 3.2) are using... I only know what 3.1 84 bit are using.
Cheers!
Yours Rava

Post Reply