fileerlangerror-recovery

Can Erlang clean-up the open file descriptors of crashed/stuck processes?


If a process crashes, what happens with the file descriptors that were only referenced by that erlang process? Is there some way to make erlang clean up automatically like an OS process or some design pattern that might help?


Solution

  • According to http://www.erlang.org/doc/man/file.html#open-2

    IoDevice is really the pid of the process which handles the file. This process is linked to the process which originally opened the file. If any process to which the IoDevice is linked terminates, the file will be closed and the process itself will be terminated.

    So, it's already done for crashed processes.

    Stuck processes are more or less like deadlocks and should be treated as such.