What is the reasoning behind the naming of the supervision `restart` options?

To quote the docs:

restart defines when a terminated child process is to be restarted.

  • A permanent child process is always restarted.
  • A temporary child process is never restarted (not even when the supervisor restart strategy is rest_for_one or one_for_all and a sibling death causes the temporary process to be terminated).
  • A transient child process is restarted only if it terminates abnormally, that is, with an exit reason other than normal, shutdown, or {shutdown,Term}.

I’m asking because from where I’m standing the naming seems to be rather … unintuitive. Especially when compared to the rather telling naming of the supervision strategies, like rest_for_one etc…

Maybe this is a naive approach but to me it seems as if the following names better reflect the intent behind the options:

  • always
  • never
  • on_error

I assume there is a historic reason behind the chosen names, and I’m curious to learn about it.

1 Like

While I can see that transient vs. temporary might not be immediately obvious I feel like I’d still prefer them over your proposed ones. It’s not about when to restart, but it’s about lifetime of the functionality a process provides. A permanent process shall be “always” available. A temporary process shall be only available until stopped and then no longer. And then transient sticks out like a sore thumb because it’s so close to temporary, but it makes sense to also have: shall be available until done.

Interesting perspective. From that point of view we could say that restart isn’t the optimal name for the configuration, can’t we?

Either way, I think we can agree that the name restart doesn’t quite fit to the naming of the options.

I’d be curious what the train of thought was when these were added.

I believe :permanent is not, in general “always available”. If your init procedure emits :ignore, then it will not be available. This is a useful tool if you have a cluster and you want a particular process to only exist on one node (for example, if it is intended to manage a resource IRL where if two competing processes try to access it you could wind up in undefined states) There are also sane ways to deal with netsplits in that case too =D.

Based on this I feel like my initial naming proposal seems to be closer to the intent of the restart configuration.

What’s your take on the initial post?