[erlang-questions] Why does this crash?

Jesper Louis Andersen <>
Sun Sep 27 11:54:46 CEST 2015


On Sun, Sep 27, 2015 at 10:52 AM, Vimal Kumar <> wrote:

> Going to add supervisors into this system and learn more about it.


It doesn't happen in real systems, because the supervision trees are linked
to the application controller, and not the shell. If you simply add a
supervision tree, and link that tree to the shell, you are usually not free
of the problem.

When developing however, you can unlink the pid:

{ok, P} = foo:start_link().
unlink(P).

which will have P not die if the shell does.

The other resources to look out for are ETS tables, and port()'s, that is
network sockets and files. If their controlling process, i.e. the shell,
goes away, then that resource is cleaned/reaped/closed again.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150927/c116f6e3/attachment.html>


More information about the erlang-questions mailing list