Out of memory freezing

5 respuestas [Último envío]
cel
cel
Desconectado/a
se unió: 03/28/2022

How to prevent the computer freezing from out-of-memory?
Maybe I have not set some settings properly when migrating from Debian.

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

Do you have some swap? If you do not know, please show us the output of the following command (to be executed in a terminal):
$ grep swap /etc/fstab
You want some swap. In this way, if the system runs out of RAM, the swap complements it. The system becomes unbearably slow but, at least, you have the time to save your work and close some applications (or some tabs in your Web browser) to free some memory. With no swap, the kernel simply kills some process to get some space. It may kill the process you have been using for hours without saving your work.

Nevertheless, swapping should be exceptional. If you frequently run out of RAM, you should either buy more RAM or try to find lightweight alternatives to the applications that take most of the space (as you can analyze using a "system monitor", probably shipping with your desktop environment). Unfortunately, nowadays, what take most of the RAM on desktop systems are usually Web pages and there is sometimes no alternative to a Web page (providing information not available elsewhere).

cel
cel
Desconectado/a
se unió: 03/28/2022

Magic Banana, thanks. I have about 1 gig of swap:

$ grep swap /etc/fstab
UUID=8ca47d52-5556-4648-91ab-8fefbb64be9c none            swap    sw              0       0

$ sudo fdisk -l /dev/disk/by-uuid/8ca47d52-5556-4648-91ab-8fefbb64be9c
Disk /dev/disk/by-uuid/8ca47d52-5556-4648-91ab-8fefbb64be9c: 976 MiB, 1023410176 bytes, 1998848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

$ free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       5.0Gi       149Mi       344Mi       2.4Gi       1.9Gi
Swap:          975Mi       975Mi          0B

Usually before the freeze occurs, the system becomes slow, as you said, so I have some time to close applications and browser tabs; but sometimes it's only a few seconds and then too late. Should this amount of "emergency" time increase with more swap? or if the vm.swappiness sysctl setting is changed? (currently at 60)

I don't see the kernel killing processes. I wonder if it would if there was no swap at all. I may try this: earlyoom (suggested by Thom Zane – thanks).

Actually, I see this repeatedly in logs (sudo journalctl -f), so looks like something is messed up with the swap full:

Apr 10 23:28:16 trisquelsd oomd[846]: [../src/oomd/plugins/SwapFree.cpp:46] SwapFree 0MB is smaller than the threshold of 97MB, total swap is 975MB
Apr 10 23:28:16 trisquelsd oomd[846]: [../src/oomd/engine/Ruleset.cpp:161] DetectorGroup=free swap goes below 10 percent has fired for Ruleset=protection against low swap. Running action chain.
Apr 10 23:28:16 trisquelsd oomd[846]: [../src/oomd/engine/Ruleset.cpp:177] Running Action=kill_by_swap_usage
Apr 10 23:28:16 trisquelsd oomd[846]: [../src/oomd/OomdContext.cpp:148] Dumping OomdContext:
Apr 10 23:28:16 trisquelsd oomd[846]: [../src/oomd/engine/Ruleset.cpp:193] Action=kill_by_swap_usage returned CONTINUE. Continuing action chain.

I suppose I could get more RAM – at 8G now, max 16G:
https://en.wikipedia.org/wiki/ThinkPad_X_series#X230

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

I have some time to close applications and browser tabs; but sometimes it's only a few seconds and then too late. Should this amount of "emergency" time increase with more swap?

It would... but what are you executing that requires that much space that quickly? It may be a program leaking memory.

I may try this: earlyoom (suggested by Thom Zane – thanks).

You may. But you have already installed oomd (given the logs) and, I repeat, you should never run out of space in "normal conditions". So, you should neither need oomd nor earlyoom. What you want to understand, monitoring the system, is what process eats up your memory. If may be a malfunctioning process. If it is not, then, yes, you could double your RAM. But 8 GB is usually OK for a desktop use (Web + movie watching + email + word processing + ...). Is it your use of the system?

alphul9
Desconectado/a
se unió: 12/31/2021

bro just install earlyoom:

sudo apt install earlyoom

this is a low memory processing daemon, with it you will forget about this problem

I suggest including this package in the default install on trisquel systems

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

If the system runs out of space, earlyoom (rather than Linux's OOM) would kill a process to free some space. It should never happen in normal conditions, but apparently does on cel's system. cel should analyze what eats up the memory (and buy some RAM if those processes are properly behaving) to truly solve the problem: having processes killed is not a good solution, whatever the OOM killer.