Include out-of-memory warnings or protection by default (e.g., earlyoom or nohang)

My Linux laptop has 8GB of RAM. On my macbook, this is fine and I get a warning if I start running out of memory.

On Linux, the out-of-memory leads to freezing and I have to press the shutdown button.

This is apparently pretty common - see addendum for list of other reported cases just for Manjaro, and it is commonly reported for other distros too. Various workarounds are suggested. I would like the distribution to have a better default, like my mac.

I request that Manjaro include some sort of default oom protection such as https://github.com/rfjakob/earlyoom or https://github.com/hakavlad/nohang with a consistent configuration that works for most people. I don't have a ton of experience with these tools yet (found them suggested at https://www.reddit.com/r/kde/comments/eg5pij/lack_of_warning_when_running_out_of_memory/), but I wanted to report this while it was top of mind.

Addendum

3 Likes

earlyoom is already in community repository. You just have to install it. Your request is to be installed by default?
In case of nohang there is an AUR package called nohang-git. Is there something wrong with it https://aur.archlinux.org/packages/nohang-git/ ?

2 Likes

I have one question.

What are you using that makes your Manjaro install eat all your 8 GB RAM? :wink:
My laptop also has 8 GB and I have never encountered an OOM freeze.

5 Likes
  1. What @Strit says. please provide:

    free --human
    cat /proc/sys/vm/swappiness
    for szFile in /proc/*/status ; do 
       awk '/VmSwap|Name/{printf $2 "\t" $3}END{ print "" }' $szFile 
    done | sort --key 2 --numeric --reverse | more
    

    (when the problem is happening. Please be patient! the Linux Laptop might just be swapping!)

  2. And:

I had a few hard stops when clicking on the wrong VM file by accident which, instead of opening virtualbox made kate (the editor :grinning: ) wake up and feel in charge. By the time you notice that something's wrong, Kate will have eaten up all ram. In my case 32 GB.

Yes, my request is that it be installed by default. When I run the KDE version of Manjaro, it comes with all sorts of programs that I don't really much care about and feel inclined to uninstall. I'm OK with that because I know most people want, say, Kate to be installed.

Yes, I could install the minimal version that Manjaro distributes, or I could install Arch Linux from scratch (which I have in the past), but I did not. I wanted something with sane defaults.

This is not only for me, but also because I want to improve the growth of desktop Linux and don't want to have to tell new people over and over to install a bunch of sane defaults.

As for what causes it - well, when it last happened I had a few Youtube videos and a few largerish git repos open in VSCode. Obviously, I didn't do a bunch of investigation as I had to do a hard shutdown to get back to to work.

Also, yeah I'm aware of that magic SysRq altho really if your system freezes so often that you remember it, that sucks. I'm also interested in a sane desktop Linux for the general user that I can recommend to my not so technical friends, not something which requires a ton of tinkering and rescuing.

Admittedly, I use a macbook mostly - because I work as a software engineer and my employers have typically standardized on macbooks because they let their employees avoid all this system configuration. Yeah, there are employers like Google who can afford to have people just creating a solid standardized Linux environment for everyone but most programmers that I know in the San Francisco Bay Area use macbooks. Many would like to switch but the lack of sane defaults doesn't make it easy.

1 Like

If you don't want your system to freeze, setup a swap partition/file. You will know when it starts building up. You can then wait for it to finish and close some processes to avoid a complete freeze.

Regarding nohang and other programs alike, you can use it if you want. But a good default for you may not be good for another person (myself, for example).

I got very near to the limit several times and I never had to turn off the machine because of it. It gets really slow, but swap prevents it and lets you manage resources if you're patient enough during those minutes. I usually switch to another tty, login as root and manage from there.

I have 8GB on my desktop and I can do a lot of parallel work without even swapping. If you RAM is building up too fast, find the culprit with top or htop, for example. You can even setup a swapfile to give you time to watch what's happening.

2 Likes

I'm also bringing this up with the KDE project. I know that Nate Graham is rather open-minded about improving default experiences, and has noted that this is a rather bad default experience (https://www.reddit.com/r/kde/comments/eg5pij/lack_of_warning_when_running_out_of_memory/fc4qqt1/).

just for your info
my manjarowish spins are including nohang,ananicy and some other since a long time.

3 Likes

I have been compiling debug tensorflow, which at its peak takes like 13GB or something.
And my laptop just has 3GB of ram. You can imagine the swapping pain for my ssd.
(of course this ignoble situation shouldn't be manjaro's business)

But the computer never locked to be honest. It was super slow at working with anything that wasn't already "painted on screen".. But still operational. And we are talking about a 1.6ghz dual core.
If your system freezes that may be a problem into itself.

2 Likes

I totally agree with this. Nohang was a must-have for me before I got more ram.

Browser windows, Steam (more chromium), Team Fortress 2 and compiling

This works to a certain degree but will inevitably lead to thrashing. As soon as my device starts thrashing its basically already over. There's nothing you can do after XOrg freezes while waiting for I/O. Even loading a tty takes MINUTES.

The core of my argument is that Manjaro should focus on making the experience for inexperienced users as good as possible. Many users may simply not know why they've "crashed" and will blame the distro or even go back to Windows and write Linux off as an unstable nerd thing.

1 Like

From what i read so far, this seems to be an issue with an optimal workflow for specific tasks. Running everything at once sounds to me a bit exaggerated ...

2 Likes

It will if you just ignore it and keep the same workflow. I've run with GBs of swap many times, including two VMs with 8GB on the host, and I never got to the point when I had to shut down the machine. It gets slow, but it's manageable. You need to adapt the load you pose on the computer according to its capabilities. You can bookmark tabs and close them, for example, close unused applications, reduce VMs assigned RAM, etc.

Also, someone mentioned bfq scheduler. I don't know how far this makes a difference, but this is what I use and it's very efficient managing high IO loads. I use it for both HDDs and SSDs (I don't have nvme).

Besides all I said, the truth is I never tried nohang. I wouldn't like a program randomly closing applications for lack of RAM, but I can see the advantage of having a warning and closing a new process for lack of RAM. I'll take a look at it to see how configurable it is.

2 Likes

anyway
i use all those that are deps of
performance-tweaks

i started this because of issues i faced
on my core2duo 4gb ram laptop.

and i still use them for my ryzen 5 3400g 16 gb ram pc

so they are something that are a must for having a smooth trouble free fast experience.

2 Likes

but i have all that without performance-tweaks nor nohang :slight_smile:

1 Like

well you will notice the difference after installing performance-tweaks

then reboot
then tell me the same

OK I will assume you already have a SSD but if you don't, then get one ASAP!!! Other then that you should should double your memory. Come to think of it, do the last one first, then the SSD.

I hope you are using at least a quad core CPU.... But I wonder if you could also benefit from an upgrade or at least use an 8c/16t processor, maybe?

That won't help any memory-related problem..

True but adding more memory will...

However the OP real problem may not be even related to memory issues at all. It could be not having enough cores and threads needed to handle a rather high CPU load...

The Storage Device Type will also have effects on performance depending on rather it is an HDD or SSD, as in how Swap performs.

The OP real problem is clear, on Linux OOM killer is not great and there is no warning notification about it. You do not solve this with hardware upgrades, but with nohang and similar softwares. I also think that it is actually a good idea to include them in the official editions.

2 Likes

Forum kindly sponsored by