6

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:

  1. I hit F4 and enter "firefox" so only firefox processes and threads appear.
  2. I hit F5 to see the list of threads
  3. 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.

enter image description here

(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.

7
  • 2
    support.mozilla.org/en-US/kb/… explins how, as per support.mozilla.org/en-US/kb/… – K7AAY Mar 27 '20 at 20:40
  • Wow! You should write an answer about the about:performance, that's 1,000× better than I've been dreaming of having in my browser! :-) – Alexis Wilke Mar 27 '20 at 21:00
  • There's absolutely no reason to have 50 tabs open in any browser. Really. That's crazy! Create some bookmark folders in your Bookmarks Toolbar. Stuff'm full of bookmarks. Close 40+ tabs. Be happy. – heynnema Mar 28 '20 at 0:10
  • @heynnema I have 512Gb of RAM and 64 CPUs, so it still flies no problem, it's just a big waste when a page uses 100% of one CPU when I'm not actively using that page. – Alexis Wilke Mar 28 '20 at 0:14
  • 1
    I'm jealous of your system... however... I'll bet that you also have 2000 app/shortcut icons on your desktop, yes? Nobody can reasonably work with 50 tabs open... how many clicks does it take you to find the tab you want? Don't want to make a big deal about this... just observ'in. – heynnema Mar 28 '20 at 0:17
12

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.

3
  • 1
    OneTab looks cool, it may be more practical than saving all my tabs as bookmarks. – Alexis Wilke Mar 27 '20 at 21:30
  • 1
    +1 excellent answer! Good job! – heynnema Mar 28 '20 at 0:14
  • 1
    grreat, sadly I can only once upvote. :D – nobody Mar 28 '20 at 8:15
2

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.

4
  • How do you "crash" a specific tab? i.e. I would imagine that I need to have the PID of the specific thread used to run that tab? – Alexis Wilke Oct 26 '20 at 15:48
  • You simply take that firefox process that uses up the CPU. Run 'top' to identify it. Kill that process and you will crash the tab that's resonsible for the load. – uli42 Oct 29 '20 at 9:17
  • Ah, I don't think it would work with top, but htop shows us the threads. I'll try that next time I run in that problem to see what happens. – Alexis Wilke Oct 29 '20 at 19:21
  • This worked better for me, as about:performance was not showing that it is extension causing the CPU ussage. – MiroJanosik Apr 29 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.