Subject: Re: 1.5.3_RC1 silent, hard lockup on OOM?
To: NetBSD Kernel <tech-kern@netbsd.org>
From: None <kpneal@pobox.com>
List: netbsd-users
Date: 04/06/2002 00:00:08
On Fri, Apr 05, 2002 at 04:44:49PM -0800, B. James Phillippe wrote:
> I was running an application with ElectricFence, and after about 10 minutes
> of steady allocation, the machine just died.  I was not root, and the
> application was not setuid root either.  My application allocates memory
> many times, but does not have a large amount of memory allocated at any one
> time (ie., there are alloc/free loops for testing certain functions).  It
> runs with no problems w/out electric fence (and completes in a fraction of
> a second), but stalls and consumes free memory (apparently endlessly) when
> linked with efence.

If I'm not mistaken, ElectricFence will never give the same piece 
of memory to an app if the app does a malloc()/free()/malloc(). Meaning,
an app that uses a bounded amount of memory without efence will use
an ever increasing amount of memory with efence. 

Now, efence I believe does an mmap() for every allocation. Run
long enough and you can exhaust the table in the kernel. I had
to bump up the limits on the FreeBSD box my employeer has on my
desk because of this limit. It's a per-system limit, not per-process
or per-user. I assume NetBSD is similar (and someone who knows will
correct me if I'm wrong I'm sure).

So, you may have run out of swap, or you may have filled the table
in the kernel. If you determine you didn't run out of swap then you
might want to mention that on the lists, or even file a PR.
-- 
"A method for inducing cats to exercise consists of directing a beam of
invisible light produced by a hand-held laser apparatus onto the floor ...
in the vicinity of the cat, then moving the laser ... in an irregular way
fascinating to cats,..." -- US patent 5443036, "Method of exercising a cat"