Comment 13 for bug 1141781

Revision history for this message
Adam Rigg (adamrigg) wrote :

It wouldn't be a complete fix for whatever the underlying issue is, but at the very least, it could be used to prevent systems from becoming unresponsive, fixing the runaway process problem. Setting the cap to a higher value would prevent it from interfering with users who are not experiencing any issues, as long as you compensate for the difference in usage with SMP by calling nproc to detect the number of cores or processors. Since limiting child processes is still experimental, and since cpulimit won't recognize the named processes for the firefox.exe or plugin-container, loop around until pidof exits with 0 (process exists) and check to make sure the user didn't close Firefox before plugin-container gets called (plugin will keep same pid for remainder of FF session). Something like this could work (replace 40 with %cpu per process):

#!/bin/bash
netflix-desktop &

numcpus=$(nproc)
FFCAP=40
PLUGCAP=40

fflimit=$[numcpus*FFCAP]
pluglimit=$[numcpus*PLUGCAP]

until [ `pidof firefox.exe` ];do
pidof firefox.exe
done

cpulimit -p `pidof firefox.exe` -l $fflimit &

until [ `pidof plugin-containe` ];do

pidof plugin-containe

pidof firefox.exe > /dev/null
if [ $? != 0 ]; then
 break
 exit $?
fi

done

cpulimit -p `pidof plugin-containe` -l $pluglimit