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

Slobodan Miskovic smiskovic@REDACTED
Wed Dec 9 23:03:08 CET 2009

On Wed, 2009-12-09 at 10:06 -0500, Bernard Duggan wrote:
> > How would I check the FD usage of a running system?
> Quick way to check on linux is to count the number of entries in
> /proc/<PID>/fd (excluding . and .. of course). 

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"),

What about other platforms, ie. Windows?

>  The command "lsof -p
> <PID>" will also show you (although it lists a bunch of other things too
> and I can't remember off the top of my head how to filter just to file
> descriptors that contribute to the processes limit).

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?

> > Do open FDs get closed if a process dies? Perhaps that's where the leak is coming from.
> >   
> In general, yes they do.  However be aware that many operations in
> Erlang spawn a process, and they're not always cleaned up in the way you
> might expect (we found a particular case with long-lasting HTTP client
> connections where you have to explicitly shut them down, even if the
> process that initiated it had crashed).  Basically, what you need to be
> concerned about is process leaks, not FD leaks per se.

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.


More information about the erlang-questions mailing list