[erlang-questions] Stopping a master process and all its workers

Torben Hoffmann torben.lehoff@REDACTED
Thu Apr 12 14:45:48 CEST 2018


Hi,

I am a bit in doubt about what would be the cleanest way to stop a part of
my supervision tree.

The tree looks like this:
top_sup
  ├─ master
  └─ worker_sup
       └─ worker

I have multiple instances of the top_sup supervisor, one for each master.
So when I need to stop a master and all its workers I would have to stop
its top_sup and everything below it.

Controlled stopping needs to be different from a crash as a controlled stop
should remove some persistent data for the master and workers.

Should I just do an exit(top_sup, normal) for the controlled stop?
Or should I implement a stop function all the way down?
Are there any subtleties that I need to cater for? Have I given enough
information for this question to make sense?

Either will do the job. Just wondering what experience others have on this.

Cheers,
Torben

-- 
https://www.linkedin.com/in/torbenhoffmann/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180412/d4127343/attachment.htm>


More information about the erlang-questions mailing list