3 ms·
> but if it crashes from a system perspective (segfault or some such), it takes down all neighbouring processes as well there are three different types of cras
by peoplefromibiza 4y ago
> but if it crashes from a system perspective (segfault or some such), it takes down all neighbouring processes as well
there are three different types of crashes in Erlang.
First there are processes `spawn`ed with the spawn primitive. If such a process crashes, there's no risk for any other process in the system, not even exceptions can bubble up (or be intercepted for that matter).
The second type is a linked process, a process whose faith has been linked to their children.
In that situation if a parent process dies, intuitively all the children processes die with it too.
If a child process dies, it brings down the parent too, and if the parent process is a child itself, recursively until the top Application process.
It sounds risky until you realize that this mechanism allows parent processes to intercept child processes dying and act accordingly (restart one, restart all, ignore it, etc.)
That's how supervision works in Erlang.
Finally, if a process crashes when running as NIF (Native Implemented Function) or, to put it simply, a native library written in C (or that can export the same C calling convention) injected into the VM, it can bring down the entire VM.