Once in a while, firefox starts using 100% of one of my CPUs. The fact is that I may have 50 tabs opened. Looking at the output of htop
I can see that one particular tab is generating the problem. Most others are either at 0% or at least under 5%, but one will be over 100%.
So with htop
I know which tab process, but how could I translate that PID into a tab name or URL? Is there an easy way? Or maybe a plugin I could install in Firefox which would be similar to htop
but show the info on a per tab basis (opposed to Linux processes as in htop
).
To find the process with htop
:
- I hit F4 and enter "firefox" so only firefox processes and threads appear.
- I hit F5 to see the list of threads
- I ignore the main process which is a total of all the others and search for the one process which specifically has 100% CPU usage
I looked at the parameters on the command line, all the parameters look the same for all the different processes so that part doesn't help at all.
(Click on the picture to enlarge, easier to read!)
P.S. I'm under Ubuntu 18.04 using the default Gnome environment, although I have had such problems on all versions, so that should have nothing to do however the solution may only work on newer systems, which would be fine too.
In Firefox, find the problems and shut them down:
Open the Task Manager by clicking on the 'hamburger' menu icon then More then Task manager - OR - type
about:performance
in the address bar.Browse in the Task Manager to find likely problem processes
Expand subtasks by clicking the right-arrowhead at the left side of the task's name
Hover over tasks and their sub-tasks to decide which is a problem
Close problem tasks (you can't close a sub-task)
More detail's at https://support.mozilla.org/en-US/kb/firefox-uses-too-much-memory-or-cpu-resources. I'm especially fond of using the extension OneTab to pull tabs offstage into a list to free up the memory and CPU they were using.
A much simpler way: If you just kill the process and watch which tab shows a problem. That is not feasible for every situation but for some workloads you often end up with the same bunch of tabs open.
Firefox and Chromium usually detect crashed or killed tabs and offer to reload the page. If after reload the CPU or memory waste vanishes chances are that you hit a browser bug.