What happens after all children of a supervisor die?
Asked Answered
L

2

6

Let's say a supervisor has a child that's continuously failing for some reason. As per restart strategy, it will restart the failing child until it reaches max restart count. What will happen to the supervisor after it reaches the max restart count?

Louisalouisburg answered 29/12, 2018 at 5:50 Comment(0)
F
7

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.

Frumenty answered 29/12, 2018 at 8:47 Comment(0)
K
4

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

Kitti answered 6/1, 2019 at 22:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.