[erlang-questions] eheap_alloc crash when using mnesia

attila.rajmund.nohl@REDACTED attila.rajmund.nohl@REDACTED
Thu Oct 23 09:44:13 CEST 2008


On Wed, 22 Oct 2008, Matthew Dempsky wrote:

> On Wed, Oct 22, 2008 at 1:33 AM, Robert Raschke <rtrlists@REDACTED> wrote:
>> Are you sure that uses plain old memory allocation for its cache
>> entries (I haven't looked, I must admit)?
>
> Yes, I chose dnscache as a concrete example because it's a server
> whose internals I'm thoroughly familiar with. :-)
>
> dnscache allocates a big chunk of memory (1000000 bytes by default) up
> front for cache storage, but while processing requests, it allocates
> additional memory for temporary storage for names relevant to the
> resolution process.
>
> E.g., if a cache receives a query for "www.erlang.org", it allocate 16
> bytes to store that name.  While resolving this query, it also
> allocates temporary space for "a.root-servers.net",
> "d0.org.afilias-nst.org", "ns.erlang.org", and so on.  Names are
> promptly freed as soon as they are no longer needed, but if allocating
> space for one of these names fails, then dnscache gives up on
> resolving "www.erlang.org" and the user tries again later.

This works for a stateless protocol like DNS - but what would you do for
e.g. HTTP? The correct answer would probably to send an "503 Service
Unavailable" answer, but that would need more memory and we've just run
out of memory. Even abruptly closing the TCP session might need more
memory to construct the FIN packet.

It's probably easier to setup a limit for maximum number of connections
that could be handled safe.
 				Bye,NAR
-- 
"Beware of bugs in the above code; I have only proved it correct, not
  tried it."



More information about the erlang-questions mailing list