Re: delayed child restart with incremental back-off
Nicolas Martyanoff <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
zxq9 <[email protected]> writes: > You don't have to implement your own supervisor to get this kind of behavior, > simply move connection out of initialization. As a general rule initialization > should never be dependent on anything outside your node's control -- > especially not something across the network. I do not know why there is such a focus on initialization. Errors can occurs during the entire lifecycle of a process; it is common to end up in a situation where a worker will fail *after* initialization, and this failure will repeat due to external consequences or to a coding mistake. In that situation, initialization tricks will not help you: the process will crash N times in a row, filling the logs with duplicate error messages, then the entire program will die. This is not acceptable for a server. Writing smart children works fine of course, I have written this kind of logic for panic recovery in Go dozens of times. Until you realize you are re-writing the exact same logic everywhere. If only we had an abstraction designed to handle this kind of restart; some kind of process which would, you know, supervise others and restart them in a configurable way. -- Nicolas Martyanoff http://snowsyn.net [email protected]