:: [DNG] Handling out of memory situat…
Página Inicial
Delete this message
Reply to this message
Autor: Martin Steigerwald
Data:  
Para: dng
Tópicos Antigos: Re: [DNG] Max Load Average
Assunto: [DNG] Handling out of memory situations (was: Re: Max Load Average)
Hendrik Boom - 18.07.24, 20:29:49 CEST:
> On Thu, Jul 18, 2024 at 05:02:03PM +0200, Martin Steigerwald wrote:
> ...
>
> > What I wonder is how out of memory conditions are / were handled by
> > Unix based operating systems. That means once swap is exhausted as
> > well.
> I wish there has a method to allocate address space without allocating
> memory. The program that wants a contiguous address space could then
> allocate memory into its reserved address space as needed, and it would
> be able to deal with memory being unavailable just as any code could
> deal with malloc returning NULL.


Yeah, that would be nice.

> > I still got not over the fact that in Linux the out of memory killer
> > just forcefully terminates processes until it is fine again.
> >
> > A reliable operating should never *ever* forcefully kill a process
> > without the user asking it to. But as long as some apps allocate
> > virtual address space as if there was no tomorrow…
>
> I wish there *was* a way I could choose and shut down a process when I
> reach the out-of-memory situation.
>
> It's usually firefox-esr that I want to shut down. It's usually the
> culprit.


Haha, browsers again.

I don't really know how to solve this "we thin provision memory by
default" thing. It is similar to our money system, except that for memory
you can prevent most of the issues by just plugging more than enough
memory into the system. On laptops for me I never had any memory issues
with 32 GiB of RAM. Quite the contrary, most often that is more memory
than I need. So that is the sweet spot for me for production laptops. But
I do not run virtual machines on them.

The music laptops has 8 GiB of RAM, which is easily more than enough as
well. The tablet has 8 GiB of RAM. Easy for some PDF reading and light
card game usage on SQLite3 Akonadi Plasma.

> I can try ctrl-alt-F1 to reach a root console to use killall
> firefox-esr. I don't even need root if it's my own firefox-esr.


With Ctrl-Alt-Esc on X11 I get a skull as a mouse pointer. Left click on a
window of an offending program and gone it is. Right click to cancel. But
be warned, AFAIK that is using SIGKILL.

> But the machine becomes so unresponsive when it happens that it's pretty
> hopeless.


Control groups could possibly help with that. Put Firefox ESR into one and
limit memory usage there. It would then for example start to swap it out
before you get into real trouble.

> There was one night I just decided to go to bed rather than wait for the
> console to reapond, wait for the oom killer or reboot. I gave the oom
> killer all night to do its job. But in the morning it still hadn't
> recovered, whereupon I ended up doing a reboot anyway.


I do not really like the OOM killer in Linux.

Systemd people have their systemd-oom meanwhile, another project they
assimilated. It more proactively gets rid of processes using Pressure
Stall Information I think.

I am still of the opinion that a reliable operating system has no right to
terminate a process due to resource constraints without *my* permission.

But with virtual address space – you get the physical memory, promised! -
over allocation you get what you ask for.

I wonder how Solaris, FreeBSD, NetBSD, OpenBSD, DragonflyBSD and other Unix
based operating systems handle this. I do believe the OOM killer is kind
of unique to Linux, but I never researched this more carefully. Does
anyone know?

Or what about Redox OS or the Genode / SculptOS stuff? Or various realtime
operating systems? Embedded systems. They can't have an OOM killer there,
or can they?

Best,
--
Martin