3

Frequent firefox crashes after upgrade to Ubuntu 22.04.

It looks that there is a memory leak. This is what I find in syslog:

May  5 14:08:18 xxx systemd-oomd[685]: Killed /user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox.c553b0b1-9931-4c5c-8e94-7f5bb31199a8.scope due to memory used (7727669248) / total (8280240128) and swap used (1934368768) / total (2147479552) being more than 90.00%

Is there a fix ?


Additional info:

$ LANG="en" free -h
               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       4.6Gi       1.3Gi       120Mi       1.9Gi       2.8Gi
Swap:          2.0Gi       1.3Gi       749Mi

EDIT 1: memory usage of the firefox thread is slowly growing even when I'm not using it. It starts at 5.4%MEM and increases above 8% even when I do nothing. And then is "crashes".

EDIT 2: firefox was automatically upgraded to version 100, but the problem persist. Visual Studio Code was also terminated by systemd-oomd. Here are the log lines in syslog about the firefox termination:

May  5 17:44:56 xxx systemd-oomd[685]: Killed /user.slice/user-1000.slice/user@1000.service/app.slice/snap.firefox.firefox.f14473ec-b4cf-4b0f-8533-ef1e41302b4e.scope due to memory used (7814512640) / total (8280240128) and swap used (2032394240) / total (2147479552) being more than 90.00%
May  5 17:44:56 xxx systemd[3093]: snap.firefox.firefox.f14473ec-b4cf-4b0f-8533-ef1e41302b4e.scope: systemd-oomd killed 130 process(es) in this unit.
May  5 17:44:56 xxx systemd[3093]: snap.firefox.firefox.f14473ec-b4cf-4b0f-8533-ef1e41302b4e.scope: Consumed 2min 19.374s CPU time.

EDIT 3: according to this announcement, systemd-oomd requires that there is enough swap space to work properly. It may be that I don't have enough swap space because I upgraded and didn't do a fresh install. Is this the explanation ?

chmike
  • 752
  • out of memory means you dont have the resources on system to run things. what are your system specs? How many Firefox tabs do you have open at once? – Thomas Ward May 05 '22 at 12:40
  • That isn't a bug, but systemd-oomd doing it's job. If it detects a program is using too much resources on your box; it's job is to kill it. With firefox & browsers in general (in my experience) it's the extensions I found that caused ram leaks; so you can remove them.. myself I prefer using them.. I wrote about it a little here - https://ubuntu-mate.community/t/what-all-is-inbound-with-22-04/25130/3 (I used to monitor the RAM leaks in the same extensions in prior releases too & used to kill firefox, chromium etc myself - systemd-oomd now does the killing for me) – guiverc May 05 '22 at 12:41
  • @ThomasWard firefox was running perfectly fine for months before the upgrade. Never had a crash. I have 8GB of memory. – chmike May 05 '22 at 12:57
  • 1
  • How could I monitor the total memory space used by firefox ? It has plenty of threads. I have the impression that the %MEM (top) of firefox is slowly increasing. – chmike May 05 '22 at 13:17

1 Answers1

3

I finally added 32GB of RAM to my computer and now have 40GB. There are no more crashes and memory usage seam stable on the long run. On 40GB it uses only 5GB.

Before upgrading the memory I tried disabling systemd-oomd as suggested here and it worked well.

chmike
  • 752
  • In 2 days you can accept your own answer. It will give you 15 reputation points and will show other users that the problem is solved. – HomerSimpson May 16 '22 at 07:35