Announcement

Collapse
No announcement yet.

Random audio skipping, and high load average

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Random audio skipping, and high load average

    I figure these two are related. Noticed when I have any kind of audio playing such as through Youtube, it will often skip, especially as I'm browsing the internet, it will skip when a new web page loads. I also noticed the load average seems to sit above 2 all the time, yet cpu is not really being used much. I closed Firefox to see if it was that but load stays high. Seems there's tons of background activity going on but not enough to make anything show up on "top". I see xord and kwin_x11 show up but they only use like 1% cpu.

    Anyone else experience this? Is there a way to see what's causing the load to be so high? I imagine this is contributing to the audio issues.

    Hardware is not super high end, but I feel it should not be struggling with basic tasks either. CPU is Ryzen 3 1300X quad core, with 8GB of ram.

    This may not be specific to Kubuntu but it only started after this upgrade. I also wonder if it's something wrong with Firefox since there's a few other weird quicks in this version, like Facebook pictures have this weird white space that pushes all the pictures to the right, and other random stuff like that.

    #2
    I would suspect a lag on the internet connection. You could test be turning off the wireless/hardwire connection and then play a video which you have already downloaded.
    Kubuntu 23.11 64bit under Kernel 6.8.1, Hp Pavilion, 6MB ram. All Bow To The Great Google... cough, hack, gasp.

    Comment


      #3
      My internet is quite solid and stable but guess it's worth a shot. Tried to play a video that I downloaded off Youtube and it didn't do it but it could just be that the video player is not affected the same way as FF. Either way the load average seems kinda high (even with everything closed), I feel something is hitting the system hard and maybe it's just affecting the browser more.

      Comment


        #4
        Run your browser unmaximized so you can have a konsole session running that you can see/access. From konsole, launch your browser and then access/play an audio file via the browser. Note the messages in the konsole.

        Alternately, in konsole, run top. Launch your browser as normal and access/play an audio file via the browser. Note what top reports as using the highest percentage of CPU.
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Yeah in top I don't see anything in particular except "web content" (which I think is Firefox) uses a decent amount of cpu to play the video but nothing crazy.

          The skips seem to be randomly triggered by any action within the browser, even just closing a tab. It happens too fast for top to update in time really. The issue is the load average is always past 2 though, something is hogging resources, but can't see what since nothing in top is using anything crazy.

          Here's a sample:

          Code:
          top - 23:49:39 up 2 days,  8:15,  1 user,  load average: 2.03, 2.78, 2.97
          Tasks: 244 total,   2 running, 241 sleeping,   0 stopped,   1 zombie
          %Cpu(s):  3.1 us,  1.1 sy,  0.0 ni, 95.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
          MiB Mem :   7957.5 total,    676.1 free,   6368.1 used,    913.3 buff/cache
          MiB Swap:   2048.0 total,   1043.0 free,   1005.0 used. 959.3 avail Mem 
          
           PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                           
          66562 ryan      20   0 3153572 581112 194988 S   7.6   7.1  13:21.42 Web Content                                                                                       
          1302 ryan      20   0 3811784  51328  25676 S   4.0   0.6  98:53.22 kwin_x11                                                                                          
          1129 root      20   0 1287068 178532 170320 S   3.0   2.2 160:00.76 Xorg                                                                                              
          57426 ryan      20   0 4072732 592768 253284 S   2.0   7.3  63:13.49 firefox                                                                                           
          25461 ryan      20   0 1163432  33232  24508 S   1.3   0.4   1:42.10 konsole                                                                                           
          57892 ryan      20   0  176296  10900  10104 S   1.3   0.1   1:38.04 RDD Process                                                                                       
          1168 ryan       9 -11 2006840   8016   5720 S   1.0   0.1  11:16.50 pulseaudio                                                                                        
          1309 ryan      20   0 3206412 182212  28244 S   1.0   2.2  42:07.87 plasmashell                                                                                       
          65900 ryan      20   0 2478536  76932  47624 S   0.3   0.9   0:11.06 Web Content
          Upon more googling I found this extension: https://addons.mozilla.org/en-CA/firefox/addon/h264ify/

          Supposedly Youtube uses a codec that is very cpu intensive, but that extension makes it use a different one. Will see if that helps.

          EDIT: nope... as soon as I switched to another tab it did it again. Maybe playing music via Youtube is just going to be out of the question on this build. Worked fine on my last build. I like to sometimes listen to "1 hour epic mix" type music guess I will just need to download them then convert to mp3.
          Last edited by Red Squirrel; May 10, 2020, 10:54 PM.

          Comment


            #6
            So is anyone else getting this or is it just me?

            It makes multitasking pretty much impossible because it's so annoying getting these constant stutters in audio. I tried to run Firefox from command line to see if it would output anything but it does not seem like Firefox runs as a "real time" app over the command line, it launches it but just goes back to a normal prompt so there is no output to be had.

            I think there is something that is hitting the system though, the load is always at around 2 even when it's idle. The cpu is low, but the load still stays high. If I can tackle that it might be the root cause.

            Also is there a way to force GPU rendering of video? Right now video uses cpu so that's probably not helping. I can't play a 4k 60fps video at all. Even 1k normal frame rate struggles a little. I feel if I have relatively new hardware I should be able to do something primitive like that as in Windows it would be zero problems. I'm not even trying to game I just want to be able to playback stuff and take advantage of the hardware I have.

            Comment


              #7
              I really don't know if this is of any help…

              I tried to test something similar: Firefox is running with 4 open tabs: Kubuntu Forums, BBC news, Youtube with a two hour long "best of" music playback and the forth one with Youtube showing a (rendered down) 1h long 4K UHD Sony test video in full screen (1280x1024).

              My four processor cores constantly use between 35 and 80%, but nothing stutters or lags, even if I load additional webpages in a fifth or sixth tab - KDE is snappy as ever when I change to the desktop or other applications and there is no problem with multitasking at all.
              And this is a quite old desktop computer (see signature).

              Could there be something wrong with your system in general or your Firefox? Have you already tried the simple test of logging in as another user?

              PS: What about your system swapping? And do you use a hard drive or a ssd?
              What do swapon -s and cat /proc/sys/vm/swappiness say?
              Last edited by Schwarzer Kater; May 18, 2020, 04:55 PM. Reason: typos, as usual and PS
              Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
              Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

              get rid of Snap scriptreinstall Snap for release-upgrade scriptinstall traditional Firefox script

              Comment


                #8
                That's the weird thing the system is still snappy unless I try to play 4k 60fps then it's like a power point presentation. It's too bad video playback does not take advantage of the GPU instead of using the CPU. Means I would probably need a threadripper if I did want to play full blown 4k content. But not a HUGE deal, more an annoyance, when you put that much money into hardware and the OS can't use it. But yeah it seems that randomly certain actions will cause audio to stutter, the best way to describe it that for maybe 100ms the volume goes very high then back down but it's also distorted, often makes me jump. If it's my system what could cause this?

                For swap here's the output of those commands:

                Code:
                $ swapon -s
                Filename                                Type            Size    Used    Priority
                /swapfile                               file            2097148 8448    -2
                $ cat /proc/sys/vm/swappiness
                60
                I only have 8GB of ram on this machine, it was originally used for GPU mining so never bothered to buy more ram, could that be an issue?

                Oh and I'm using a SSD for the OS drive.

                I wonder if it might be worth upgrading the CPU, though that probably means upgrading the motherboard too as the sockets may have changed in the past few years. I don't fully keep up with this stuff.
                Last edited by Red Squirrel; May 18, 2020, 10:05 PM.

                Comment


                  #9
                  Well, it could be an issue - I don't know if swap really is the reason in your case…
                  If I could not find the exact reason for the stuttering and I were you and had the money I would buy another 4 or 8 GiB of RAM first before upgrading CPU (and mainboard).
                  And reduce the swappiness to, let's say: 5, before that (perhaps you will have to try a bit with your machine to find the optimal value):

                  Code:
                  $ cd /etc
                  $ sudo cp sysctl.conf sysctl.conf.orig
                  $ sudo nano sysctl.conf
                  and add to the end of the file:
                  # reduce swappiness for workstation and ssd (default=60)
                  vm.swappiness=5


                  save with [Ctrl] [o], [Return], [Ctrl] [x]

                  Restart Kubuntu and test again.

                  PS: in post #5 your top says that swap nearly is 1 GiB…

                  PPS: the suggestion in the Ubuntu documentation is to reduce the swappiness to 10 for desktop systems (with a hard disk, I presume): https://help.ubuntu.com/community/SwapFaq
                  Last edited by Schwarzer Kater; May 19, 2020, 02:47 AM. Reason: typos, as usual and PS
                  Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
                  Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

                  get rid of Snap scriptreinstall Snap for release-upgrade scriptinstall traditional Firefox script

                  Comment


                    #10
                    It does it even when swap is low, right now it's 9.2 and it just did it. Will try that swappiness setting and see if that helps though. I find with Linux it's hard to tell how much ram you actually have free because it caches so it always looks like you don't have lot of ram left.

                    If that setting does not work then I'll order a 4x8GB kit and put in more ram. I probably won't be able to find a stick to match what's there as it was bought a few years ago.

                    Comment


                      #11
                      Well, what I find strange is:

                      MiB Mem : 7957.5 total, 676.1 free, 6368.1 used, 913.3 buff/cache
                      MiB Swap: 2048.0 total, 1043.0 free, 1005.0 used. 959.3 avail Mem


                      At the moment, I have 8 tabs open in FF - one of which is a Youtube video - and...
                      KiB Mem : 8115600 total, 3919936 free, 2443052 used, 1752612 buff/cache
                      KiB Swap: 8190972 total, 8190972 free, 0 used. 5224160 avail Mem


                      If I close 6 of them, I have:
                      KiB Mem : 8115600 total, 4686780 free, 1732044 used, 1696776 buff/cache

                      Maybe it has to do with you system being
                      up 2 days, 8:15
                      and not releasing memory properly?

                      Comment


                        #12
                        Tell you what
                        Save the attached file (2.7 KB ;·)
                        If you haven't got conky,
                        sudo apt install conky-all (it's not a bad thing to have :·)
                        Open a konsole where that file is, and type:
                        conky -c ./conkyrcmem.txt

                        You should see something like this:

                        Click image for larger version

Name:	Screenshot_0519_182602.png
Views:	1
Size:	13.0 KB
ID:	644749

                        on the left of your screen. If you'd rather have it on the right, change alignment = 'top_left', to alignment = 'top_right', (and/or play around with gap_x and gap_y)
                        If you edit it, it's probably best to remove the .txt extension.
                        If you like it, make a link to that command somewhere.
                        The bar will catch your eye if properly positioned

                        Of course, if you'd like a more complete system monitor, you can always get something like this :·)
                        Attached Files

                        Comment


                          #13
                          Originally posted by Red Squirrel View Post
                          So is anyone else getting this or is it just me?
                          Mmm... only noticed similar occurrences since the 20.04 upgrade
                          I have other issues and ever since this new release, I'm somewhat tempted to revert
                          I didn't have these hassles on 19.10
                          I use QMMP for audio and haven't figured why it occasionally stutters...
                          but as for Firefox and Youtube playback, I've found that instead of using FF for such...
                          I drag-n-drop those urls onto mpv and that seems to have sorted out those video and cpu niggles
                          (assuming that youtube-dl is installed)

                          Comment


                            #14
                            As a side note, how do you record the audio stream of what is playing in Audacity? It worked before in other distros but if I recall I had to jump through some hoops to get it working.

                            I want to record and post it as it might shed more clues as to what is going on. I'm also kind of curious to look at the audio wave form when it happens.

                            Comment


                              #15
                              I may have found something, if I do journal -f

                              The skips seem to coincide with logs that look like this:

                              Code:
                              May 27 20:17:40 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:17:40 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:32 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:32 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Supervising 6 threads of 3 processes of 1 users.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Successfully made thread 6176 of process 6120 owned by '1000' RT at priority 10.
                              May 27 20:19:39 falcon rtkit-daemon[1245]: Supervising 7 threads of 4 processes of 1 users.
                              Did not find much on Google on that but did read something about it meaning it's lowering the priority of pulseaudio. In top it has a priority of -11. I don't know if that's low or not, but I wonder if that's part of the issue?

                              I notice I can reproduce the issue with doing refresh on Facebook. Facebook is a pretty bloated site so it hits the cpu hard. But still, this is not a 486, it should be able to handle loading a web page and play audio at same time. Is there a way to perhaps raise the priority of pulseaudio?

                              Comment

                              Working...
                              X