Search code examples
erlangerlang-supervisorerl

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?


Solution

  • 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.