1

I Installed Ubuntu 20.04 some days ago, on a system with a 500GB SSD and 16GB of ram. It runs incredibely fast. I used mainly for web development with docker and 2 browsers opened.

After 2 - 3 days using it notice that sometimes, after have used it for a few hours it suddendly froze for many minutes, sometimes it recover normallity but others i have to press the RESET button.

Looking into this, it seems like the swap is being used, more and more until is filled completely, and I"ve notice that each time it froze, swap is 100% used, with 0 bytes left.

Initially it was a 2GB /swapfile I increase it to 8GB,

free -hm
              total        used        free      shared  buff/cache   available
Mem:           15Gi        13Gi       405Mi       102Mi       1.3Gi       1.1Gi
Swap:         8.0Gi       8.0Gi        21Mi



$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0 8184072 1159480 106780 1429920   30   68   264   161   79   37 18  6 76  0  0
 0  0 8184072 1160328 106788 1430064   20    0   104   164 2386 7913 17  6 77  0  0
 2  0 8184072 1101808 106796 1430072   76    0    76    56 2266 7488 16  6 77  0  0
 0  0 8184072 1159684 106804 1415396   28    0    28   224 2456 8942 18  7 76  0  0
 0  0 8184072 1148108 106804 1415468   16    0    24     0 2395 8012 20  6 75  0  0
 0  0 8184072 1162416 106868 1415628    0    0     8 10032 2627 8865 27  6 66  1  0
 1  0 8184072 1213260 106868 1415632    0    0     0     0 3677 7461 18  8 74  0  0
 0  0 8184072 1218236 106868 1415656  108    0   132     0 2287 7940 14  5 82  0  0
 0  0 8183816 1216772 106868 1415644  252    0   300     0 2742 9758 24  5 71  0  0
 0  0 8183816 1216968 106896 1415776   12    0    16   752 2300 8125 16  6 78  0  0
 0  1 8178440 1159532 106912 1434828 6844    0 16772     0 6270 19751 35  8 56  1  0
 2  0 8168200 1030912 107140 1441496 12480    0 18668   216 14645 19022 60 11 28  1  0
 1  0 8166408 979080 107140 1443392 2040    0  3860     0 7176 12398 56  6 38  0  0
 2  0 8165896 970196 107156 1443220  644    0   644   408 11478 10704 56  5 39  0  0
 1  0 8165896 974404 107172 1441176   72    0    72   216 4232 11306 41  5 54  0  0
 1  0 8165384 1013824 107172 1431864  564    0   564     0 9214 12768 38  8 54  0  0
 5  0 8164104 876940 107176 1440800 1500    0  1620   608 9258 20153 48  7 45  0  0
 4  0 8164104 742736 107192 1440848  272    0   272   224 7449 12620 56  5 38  0  0
 7  0 8164104 926696 107232 1440640  292    0   292  3076 6702 14253 44  8 48  0  0
 2  0 8162824 899408 107232 1440764 2052    0  2056     0 4738 12986 38  6 56  0  0
 2  0 8161800 886416 107232 1440956  912    0  1092     0 11952 17109 39  7 54  0  0
                                                                                                                                    

    top - 06:29:52 up 16:09,  2 users,  load average: 1.35, 1.87, 1.75
Tasks: 426 total,   2 running, 420 sleeping,   0 stopped,   4 zombie
%Cpu(s): 24.7 us,  4.5 sy,  0.0 ni, 70.7 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15965.7 total,    714.1 free,  13738.2 used,   1513.3 buff/cache
MiB Swap:   8192.0 total,    227.5 free,   7964.5 used.   1616.1 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   5238 nh        20   0   11.5g   1.5g 117064 R  60.5   9.6 137:21.61 firefox
  64514 nh        20   0  621592  27624  22176 S  11.8   0.2  84:53.46 youtube-music-d
  64528 nh        20   0 9278472 112372  20812 S   6.8   0.7  59:40.88 youtube-music-d
  64577 nh        20   0 4724728   7068   4712 S   5.2   0.0  36:57.94 youtube-music-d
  64283 nh        20   0 4927544  46564  15200 S   4.1   0.3  31:13.02 youtube-music-d
   5341 nh        20   0 6486452   2.2g  59748 S   3.9  14.3  73:51.02 Web Content
  15675 nh        20   0 3112492 322920  41744 S   3.9   2.0  36:20.51 Web Content
 135808 nh        20   0   36.5g 202720 103396 S   2.8   1.2   0:09.46 chrome

I also modified some somethings on the /etc/sysctl.conf:

vm.swappiness=5
vm.min_free_kbytes=240000

This settings are new (including the 8Gb size) and it has not frozen yet, but I noticed that is again almost used 100%. I will update if it frozes again :_)

2
  • Definitely not normal: this must be some memory leak.
    – vanadium
    Mar 12, 2021 at 12:50
  • It looks like firefox (11.5g virtual, 60.5%CPU) and chrome (36.5g virtual, 2.8%CPU) are trying for unchecked growth. Swap space is not allocated on its own, it's allocated based on virtual memory usage.
    – waltinator
    Mar 12, 2021 at 18:16

0

Your Answer

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

Browse other questions tagged or ask your own question.