[erlang-questions] Understanding supervisor / start_link behaviour

Jachym Holecek <>
Thu Jun 2 16:37:39 CEST 2011


# Mazen Harake 2011-06-02:
> I wouldn't say that you are wrong. I think that you are reasoning good
> about not putting the gen_event module under a supervisor because
> *that is what links are for*. Just because you have a supervisor
> doesn't mean the you shove everything underneath there! If the
> gen_server and the gen_event are truly linked (meaning: gen_server
> doesn't act as a "supervisor" keeping track of its gen_event process
> and restarts it all the time but rather that they really are linked
> and they crash together) then your approach, in my opinion, is good.

FWIW couldn't agree more with this. For completeness (it's obvious and you're
no doubt aware of it): 'normal' exits don't kill linked peers, which takes a
little getting used to, but is trivial to manage.

As a more general point, designing sensible supervision trees was probably
the most difficult engineering aspect of OTP for me to learn, so I guess
people shouldn't feel too bad if it feels intimidating initially. :-)

BR,
	-- Jachym



More information about the erlang-questions mailing list