[erlang-questions] eheap_alloc crash when using mnesia

Robert Raschke rtrlists@REDACTED
Wed Oct 22 10:33:39 CEST 2008


On Tue, Oct 21, 2008 at 10:46 PM, Matthew Dempsky <matthew@REDACTED> wrote:
> Simple example: dnscache from djbdns.  Handling each new DNS query
> requires allocating some temporary space for domain names that it
> needs to resolve in the process.  If it fails to allocate memory for a
> request at some point in the resolution process, it gives up on that
> query, frees any memory it used, and continues handling other queries.
>  This is a far better solution than crashing and dropping *every*
> query *and* flushing the entire cache.

Are you sure that uses plain old memory allocation for its cache
entries (I haven't looked, I must admit)? The kind of cache handling
you describe would most likely use it's own cache size management,
otherwise it would be quite easy to mount a denial of service attack
on this DNS server (i.e., crash it) by flooding it with lots of new
domain names (assuming it doesn't have some other mechanism to detect
this).

> The same principle applies to any process handling multiple requests
> simultaneously.

I would guess that most programs that allow for this have limits set
(if they don't have them explicitly, they'll be using the OS limits).
If you're in control of those limits, then they are probably linked to
things like available memory, bandwidth and other resources.

I've never looked into the mechanisms that Erlang may provide for
handling constrained memory. If I would want to write an Erlang server
and make sure its memory consumption never grows beyond some limit,
where would I start reading?

Robby



More information about the erlang-questions mailing list