Announcement

Collapse
No announcement yet.

Firefox eating up a lot of CPU

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Firefox eating up a lot of CPU

    Kubuntu 24.04, AMD Ryzen 7 processor, 7840HS w/ Radeion 780M Graphics

    Not sure if this is the right forum...

    I am seeing Firefox eat up a lot of CPU time. Firefox itself is using anywhere from 14-38% CPU, while a process called Isolated Web Content (several processes running this executable image) is taking up anywhere from 16 - 45% CPU.
    I found this web page on Mozilla's site:
    https://hacks.mozilla.org/2021/05/in...-architecture/

    There are a lot of discussions on this problem and in particular about Isolated Web Content, but I'm wondering if anyone has a 'recommended' way to fix the heavy CPU resource consumption.


    #2
    Extensions?
    Video playback, specifically?
    I don't have the problem here.

    It is possible, though not likely, that it could be due to being a Snap package, but I have never seen that high a usage myself., even using the stock Snap firefox.
    I'd check if FF is using hardware acceleration or not
    Also trying FF Troubleshoot mode from it's hamburger menu, or trying a fresh, clean profile.

    I'd check hardware accel first
    Recent hits:
    https://forum.snapcraft.io/t/firefox...vailable/38696

    If using a deb, there are too many how-tos out there, and they are mostly also useful for the Snap.

    Comment


      #3
      Yes, the problem occurs specifically on video playback.
      I did see a lot of forum discussion (various forums, not kubuntuforums) talking about a "traditional" installation which I believe they meant not a snap package. I can certainly try that.

      Thanks for the pointers, claydoh. I think I was focusing on some minutia that I read and didn't want to go down the path of messing with sysctl (read about this as well as a bunch of stuff about kernel modifications and so forth) without understanding the problem better.

      Comment


        #4
        I tested it on my system and no where close to what the original poster inferred. One thing of note is I'm not using the snap version. I've purged my system of snap and I use traditonal (non-snap version) firefox (how to here). So I lend my support to Claydoh that it should be snap related.
        Challenges are what that keeps us from the borderline of boredom in life's journey. Linux user no. 419401 currently running Kubuntu 24.04
        _______________________________________________
        Current System: Beelink Mini PC, AMD Ryzen 7 5800H 8 Core(Up to 4.4GHz), 32GB DDR4 RAM 1TB NVME M.2 SSD, SER5 MAX Mini Desktop Computer with TCL BeyondTV5 serving as my monitor. ​

        Comment


          #5
          I have been using firefox snap and no problen at all. An youtube 4K movie 60 fps hdr is using 5% - 6% CPU .

          Comment


            #6
            Update... I've been researching for days, and I've tried a whole bunch of stuff. Firefox plays the audio, but the video is frozen.

            I can access pretty much any other web site except YouTube, and other than videos on YouTube (or embedded YouTube videos in arbitrary web pages) I am not having any problems with Firefox.

            I do have the snap version of Firefox. So I will get rid of that and try the instructions that Princey suggested:
            https://www.kubuntuforums.net/forum/...tional-firefox

            Comment


              #7
              Well, I uninstalled snap firefox, rebooted, then re-installed just to satisfy myself that I could run it--as others have said that they can run it without issues...

              So now it seems to be working. I can play YouTube videos, and the system load average is 3.05, firefox %CPU is about 15-18%.

              In the interest of getting on with other issues (printer configuration, audio headphone issues, etc) I'll just stay with this for now.

              Comment


                #8
                A little update....

                After starting Firefox from a bash shell, it ran fine. But it put an application icon in the Task Manager. I pinned to the Task manager. And the next time I started Firefox from by clicking the icon in the Task Manager, Firefox would not play YouTube videos.

                I uninstalled and then reinstalled. If I start it from the bash command line, it seems to work fine... I'll test again however, cycling through shutdowns and restarts of Firefox and my system.

                Comment


                  #9
                  Well, I did some more debugging. Here is the synopsis of the scenario that causes the problem.

                  I have snap Firefox installed.
                  Code:
                  $ snap list
                  Name Version Rev Tracking Publisher Notes
                  bare 1.0 5 latest/stable canonical✓ base
                  core22 20240731 1564 latest/stable canonical✓ base
                  firefox 129.0.2-1 4793 latest/stable mozilla✓ -
                  firmware-updater 0+git.5007558 127 latest/stable/… canonical✓ -
                  gnome-42-2204 0+git.510a601 176 latest/stable/… canonical✓ -
                  gtk-common-themes 0.1-81-g442e511 1535 latest/stable/… canonical✓ -
                  snapd 2.63 21759 latest/stable canonical✓ snapd
                  thunderbird 128.1.0esr-1 507 latest/stable/… canonical✓ -
                  $
                  If I start firefox from the shell command line, it runs fine. It runs the shell script in /usr/bin/firefox, which ultimately executes /snap/bin/firefox. Clearly that shell script is doing some configuration that I don't understand.

                  If I​ hit Alt-space I see the menu in the referenced screen grab here:
                  https://www.imgbly.com/ib/TH870tGtQE

                  If I select the first entry, to run firefox from the command line, it has the same effect as starting /usr/bin/firefox from a bash shell; it works fine. However, if I select the third entry, firefox does not play any video; I've mostly tested with YouTube videos that have actual video and audio.

                  I'm not sure what gets executed when I select the third option from the Alt-space menu. It appears from doing a "ps -ef" that it's the same /snap/firefox/... executable. But I'm wondering why is this entry in the Alt-space menu and how does it get initialized or 'configured' to run.

                  Additionally, if I do start firefox from the entry with the firefox browser icon, and it fails to play video, I must then uninstall firefox using snap and then reinstall in order to get video playback to work. That is, after a failed start, simply exiting firefox and restarting it from the shell command line will not work; firefox will not play video correctly at all.

                  I have not posted the firefox shell script but could do so if requested.
                  Last edited by rhimbo; Aug 23, 2024, 10:20 AM.

                  Comment


                    #10
                    I also noticed that on my Beelink Mini PC desktop, "snap list" lists firefox as
                    "firefox 129.0.2-1 4793 latest/stable mozilla✓ -"

                    But on my old Lenova laptop running the same kubuntu version, "snap list" lists firefox as
                    "firefox 129.0.2-1 4757 latest/stable mozilla -"

                    ​I'm up to date on both systems via "sudo apt update"' and "sudo apt upgrade"

                    Comment


                      #11
                      Well, I went a different route. I ended up installing the 'normal' firefox from Mozilla, retrieved here:
                      https://www.mozilla.org/en-US/firefox/download/thanks/

                      I will file a bug with Mozilla regarding the snap version. There is clearly a configuration problem. The /usr/bin/firefox shell script came with my kubuntu install (I didn't install anything). Yet, without snap firefox it gives an error:

                      Code:
                      $ /usr/bin/firefox
                      
                      Command '/usr/bin/firefox' requires the firefox snap to be installed.
                      Please install it with:
                      
                      snap install firefox
                      
                      $
                      $
                      And if I run the snap firefox by executing /snap/bin/firefox that fails too (fails to play any video or audio). So it seems that snap firefox needs the configuration performed by /usr/bin/firefox shell script. Thus I'm thinking that the /usr/bin/firefox shell script is out of sync with /snap/bin/firefox binary.

                      Comment


                        #12
                        (I use the firefox installed to /opt from the tarball, that is, firefox-129.0.2.tar.bz2).

                        I use
                        Code:
                        sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox
                        Normally $PATH has /usr/local/bin ahead of /usr/bin/.
                        Regards, John Little

                        Comment


                          #13
                          Originally posted by jlittle View Post
                          (I use the firefox installed to /opt from the tarball, that is, firefox-129.0.2.tar.bz2).

                          I use
                          Code:
                          sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox
                          Normally $PATH has /usr/local/bin ahead of /usr/bin/.
                          Yes, my PATH looks like this:
                          Code:
                          /home/rhimbo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

                          ​And my sym links are the same:
                          Code:
                          $ pwd
                          /opt/firefox
                          $ ls -l
                          total 203296
                          -rw-r--r-- 1 root   root         899 Aug 19 09:13 application.ini
                          -rw-r--r-- 1 root   root         189 Aug 19 10:11 dependentlibs.list
                          -rwxr-xr-x 1 root   root        5432 Aug 19 10:12 firefox
                          -rwxr-xr-x 1 root   root      957488 Aug 19 10:12 firefox-bin
                          -rw-r--r-- 1 root   root        1449 Aug 19 12:20 firefox-bin.sig
                          -rw-r--r-- 1 root   root        1449 Aug 19 12:20 firefox.sig
                          .
                          .
                          .
                          $
                          $
                          $ pwd
                          /usr/local/bin
                          $ ls -l
                          total 0
                          lrwxrwxrwx 1 root root 20 Aug 26 10:45 firefox -> /opt/firefox/firefox
                          $​
                          $
                          But yesterday and today, even the Mozilla version (installed as you did using the .tar.gz file downloaded from Mozilla) does not play video. And now even audio is stuttering, not smooth.

                          I did notice today that I have different binaries on my laptop (on which firefox works fine) and the desktop PC (on which firefox is not working).

                          On the desktop PC:
                          Code:
                          $ which firefox
                          /usr/local/bin/firefox
                          $
                          $ firefox --full-version
                          Mozilla Firefox 129.0.2 20240819150008 20240819150008
                          $
                          On the laptop:
                          Code:
                          $ which firefox
                          /usr/bin/firefox
                          $
                          $ firefox --full-version
                          Mozilla Firefox 129.0.1 20240813010450 20240813010450
                          $
                          I'm going to try to grab version 129.0.1 to install on the desktop -- if I can find where to download that version. And if that version works, then I will assume the problem lies with Mozilla.
                          Last edited by rhimbo; Aug 27, 2024, 01:16 PM.

                          Comment


                            #14
                            Well... same (bad) result with firefox 1.29.0.1

                            So the problem must be with some configuration of my OS/packages/libraries.

                            At this point I think I'll just do a clean install of kubuntu.... getting really, really, really tired of this....





                            Comment


                              #15
                              Originally posted by rhimbo View Post
                              Well... same (bad) result with firefox 1.29.0.1

                              So the problem must be with some configuration of my OS/packages/libraries.

                              At this point I think I'll just do a clean install of kubuntu.... getting really, really, really tired of this....





                              Sorry to make this question, but are you sure you check on about:config if hardware accelleration is enable?

                              Comment

                              Working...
                              X