[erlang-questions] Mnesia could not write core file: system_limit

Bernard Duggan bernie@REDACTED
Thu Dec 10 00:00:11 CET 2009


Slobodan Miskovic wrote:
> Heh, thinking outside of the (VM) box - guess there is no query-able
> interface in Erlang for this? Linux is then indeed simple enough:
> {ok, FDList} = file:list_dir("/proc/self/fd"),
> length(FDList)
>   
Huh - never noticed the 'self' symlink - that's really handy :)
As far as I know there's no specific interface in Erlang for this - I'd
expect it to either be in maybe os: or erlang:, but I can't see anything
there.
> What about other platforms, ie. Windows?
>   
Sorry, I can't help you there.
> Would lsof (or similar mechanism) be preferable as I would get a list of
> open sockets and network connections which as I understand all
> contribute to the max open ports limit. Would I get all those in
> the /proc/.../fd list as well?
>   
/proc/self/fd should include all file descriptors that contribute to the
process's limit - pipes, sockets, files etc.  It's what we use for
monitoring exactly this issue on some of our C++ code.
> Hm, I have embedded Yaws running, and occasionally processes terminate
> when invalid requests comes in. I would have thought those would have
> been really dead. I'll have to keep an eye on the running system to see
> if number of processes is rising.
>   
Proces leaks are the memory leaks of Erlang - they're relatively easy to
accidentally code if you're not careful.
If you're running a long-running server app I'd suggest looking at
providing an SNMP monitoring system to keep an eye on this kind of thing
- Erlang's built-in SNMP stuff is a pain in the backside to initially
set up, but once you've got it going it's trivial to add a lot of really
informative information.

Cheers,

B


More information about the erlang-questions mailing list