What happens after all children of a supervisor die?

It'll terminate itself and its supervisor decides whether to restart it according to the supervisor's policy. If it doesn't have a supervisor (it's a root), then it won't be restarted. That's the point of supervision trees.


as Alexey Romanov already answered, the supervisor will also fail and so the parent supervisor itself is executing its own strategy. The supervisor strategies have to be aligned between the parent and child supervisors, otherwise a parent supervisor might never fail if its MaxTime for restarts is set incorrectly compared to the child supervisor. If there is no supervisor left, the application itself will crash. If the application is running for example as a windows service, that service itself can have a restart strategy set.

Example:

child supervisor: max restarts 10, max time: 10secs -> child supervisor will crash if its own children have more than 10 crashes within 10secs

parent supervisor: max restarts: 20, max time: 5 secs -> child supervisor has to crash 20 times in 5 secs. That also means that the child of the child supervisor would have to crash > 200 times within 5 seconds in order to crash the parent supervisor

Also check out the following https://learnyousomeerlang.com/supervisors