From: "Lasse Kärkkäinen" <tronic+bpsk@trn.iki.fi>
To: linux-kernel@vger.kernel.org
Subject: Avoiding crash in out-of-memory situations
Date: Tue, 01 Sep 2009 16:24:09 +0300 [thread overview]
Message-ID: <4A9D2079.3000805@trn.iki.fi> (raw)
Currently a number of simple while (1) malloc(n); processes can crash a
system even if resource limits are in place as one can only limit the
memory usage of a process (not that of an user nor the total used by the
userspace) and any otherwise reasonable nproc and memory limits can be
circumvented by using more processes.
The OOM killer is supposed to work as a fallback in these situations,
but unfortunately the system still goes absolutely unresponsive for
about 10 minutes whenever the OOM killer runs. It would seem that this
happens because the kernel first gets rid of all buffers and caches,
slowing things down to a halt, and the OOM killer activates only after
nothing else can be done.
In a more complex situation (e.g. the one that we just had on our server
by accidentally running too many valgrind processes) this hang state can
take very long, essentially requiring the server to be reseted the hard way.
As there AFAIK is no existing remedy to this problem, I would suggest
implementing either (a) per-user limits, (b) a memory reserve for the
kernel (e.g. one could reserve 100 MB for the kernel/buffers/caches,
giving less for the userspace to allocate even if that means having to
kill processes) or (c) both of them.
Or perhaps there is something that I missed?
P.S. using or not using swap doesn't really affect the fundamental
problem nor its symptoms, so please don't suggest that either way.
next reply other threads:[~2009-09-01 13:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 13:24 Lasse Kärkkäinen [this message]
2009-09-02 1:11 ` Avoiding crash in out-of-memory situations KAMEZAWA Hiroyuki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A9D2079.3000805@trn.iki.fi \
--to=tronic+bpsk@trn.iki.fi \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox