Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang: Who supervises the supervisor?

In all Erlang supervisor examples I have seen yet, there usually is a "master" supervisor who supervises the whole tree (or at least is the root node in the supervisor tree). What if the "master"-supervisor breaks? How should the "master"-supervisor be supervised?? any typical pattern?

like image 472
Daniel Avatar asked Apr 18 '11 08:04

Daniel


People also ask

What is supervisor in Erlang?

Supervisors are one of the core things that make Erlang/OTP what it is. An active OTP application consists of one or more processes that do the work. Those processes are started indirectly by supervisors, which are responsible for supervising them and restarting them if necessary.

What is supervision tree?

1.1 Supervision Trees Supervisors are processes that monitor the behaviour of workers. A supervisor can restart a worker if something goes wrong. The supervision tree is a hierarchical arrangement of code into supervisors and workers, which makes it possible to design and program fault-tolerant software.


1 Answers

The top supervisor is started in your application start/2 callback using start_link, this means that it links with the application process. If the application process receives an exit signal from the top supervisor dying it does one of two things:

  1. If the application is started as an permanent application the entire node i terminated (and maybe restarted using HEART).

  2. If the application is started as temporary the application stops running, no restart attempts will be made.

like image 52
Lukas Avatar answered Oct 19 '22 02:10

Lukas