ubuntu (21.04) get's into loop when playing online video

Sometimes when I watch videos from one site, they get stucked in short loop with video and sound but I can't do absolutely nothing except shutdown computer by holding power button. Any idea what could be happening? By nothing I really mean nothing including swaping to another terminal.

I was digging trough syslog for some more info, I hope it'll help... tho I'm not sure if there is real solution since of the log:

Sep  5 19:04:00 orange-NB named[1062]: network unreachable resolving './NS/IN': 2001:500:2d::d#53
Sep  5 19:04:00 orange-NB named[1062]: network unreachable resolving './NS/IN': 2001:500:9f::42#53
Sep  5 19:04:00 orange-NB named[1062]: resolver priming query complete
Sep  5 19:04:42 orange-NB /usr/libexec/gdm-x-session[2452]: (EE) client bug: timer event8 tap: scheduled expiry is in the past (-3436ms), your system is too slow
Sep  5 19:05:11 orange-NB systemd-modules-load[287]: Inserted module 'lp'
Sep  5 19:05:11 orange-NB kernel: [    0.000000] microcode: microcode updated early to revision 0xea, date = 2021-01-05
Sep  5 19:05:11 orange-NB kernel: [    0.000000] Linux version 5.11.0-31-generic (buildd@lcy01-amd64-009) (gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU Binutils for Ubuntu) 2.36.1) #33-Ubuntu SMP Wed Aug 11 13:19:04 UTC 2021 (Ubuntu 5.11.0-31.33-generic 5.11.22)
Sep  5 19:05:11 orange-NB kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.11.0-31-generic root=UUID=d7823b21-8e2b-498b-bf7b-a4e9125c5c23 ro quiet splash vt.handoff=7
Sep  5 19:05:11 orange-NB kernel: [    0.000000] KERNEL supported cpus:
Sep  5 19:05:11 orange-NB kernel: [    0.000000]   Intel GenuineIntel
Sep  5 19:05:11 orange-NB kernel: [    0.000000]   AMD AuthenticAMD
Sep  5 19:05:11 orange-NB kernel: [    0.000000]   Hygon HygonGenuine
Sep  5 19:05:11 orange-NB kernel: [    0.000000]   Centaur CentaurHauls
Sep  5 19:05:11 orange-NB kernel: [    0.000000]   zhaoxin   Shanghai

included some messages around, network errors in this case can be ignored, I don't have IPv6, I gues problem is message at time Sep 5 19:04:42

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          7,7Gi       2,5Gi       2,6Gi        43Mi       2,5Gi       4,8Gi
Swap:         2,0Gi          0B       2,0Gi
$ sysctl vm.swappiness
vm.swappiness = 60

renamed from system lang:

$ swapon -s
File name           Type        Size        Used    Priority
/swapfile           file        2097148     0       -2
$ ls -al /var/crash 
total 12
drwxrwsrwt  2 root     whoopsie 4096 zář  5 19:05 .
drwxr-xr-x 15 root     root     4096 úno 14  2021 ..
-rw-r--r--  1 orange   whoopsie    0 zář  5 15:13 _opt_Qt_Tools_QtCreator_libexec_qtcreator_clangbackend.1000.upload
-rw-------  1 whoopsie whoopsie   37 zář  5 15:13 _opt_Qt_Tools_QtCreator_libexec_qtcreator_clangbackend.1000.uploaded
$ top
top - 22:07:08 up  3:02,  1 user,  load average: 1,14, 1,45, 1,60
Tasks: 278 total,   1 running, 277 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10,6 us,  7,1 sy,  0,0 ni, 82,1 id,  0,1 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :   7839,5 total,   2615,2 free,   2636,9 used,   2587,4 buff/cache
MiB Swap:   2048,0 total,   2048,0 free,      0,0 used.   4871,5 avail Mem 

... (running aplications)

Solution 1:

Your /swapfile may be the problem. Let's increase it from 2G to 4G...

Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 8G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation