[erlang-questions] "simple_one_for_one" supervisor childs termination problem

Matthew Sackman matthew@REDACTED
Tue Nov 30 12:26:01 CET 2010


On Tue, Nov 30, 2010 at 12:09:56PM +0100, Lukas Larsson wrote:
> When terminating a child the supervisor calls exit(Pid,shutdown). When a
> process receives an exit signal it will automatically die unless it is
> trapping exits. So in order for terminate to be called before the process
> dies you have to trap exits within the child process.

Yeah, but trapping exits is not normally a good idea. Zabrane probably
wants to use Rabbit's supervisor2 [0] which adds
simple_one_for_one_terminate which is the same as simple_one_for_one
except children are killed off as per the indicated shutdown spec (see
man supervisor).

[0] http://hg.rabbitmq.com/rabbitmq-server/file/default/src/supervisor2.erl

Matthew


More information about the erlang-questions mailing list