restarting child processes
Samuel Rivas
samuel@REDACTED
Thu Oct 20 08:28:09 CEST 2005
Lennart Ohman wrote:
> the childprocess (or worker) crashes in its init-phase. You
> can se this by examining the Context field in the supervisor
> report (start_error). The supervisor will then consider itself
> to be a failure and crash in its own initphase.
> As a note, your child is actually not a proper OTP process either,
> or to put it in a more polite way :-) one can say that you have
> choose to role-your-own by not using for instance the gen_server
> behaviour.
Well, the serious problem is not not using the gen_server behaviour,
a supervisor can start other processes if you follow the instructions in
the manual. The main issue is that start_child() is not starting any
process at all.
So, paraphrasing the manual:
"The start function must create and link to the child process, and
should return {ok,Child} or {ok,Child,Info} where Child is the pid of
the child process and Info an arbitrary term which is ignored by the
supervisor."
Whereas start_child simply goes into a receive block and crashes after
750 ms. Thus, it is not the child process who is crashing but the
supervisor process itself.
Regards.
--
Samuel
More information about the erlang-questions
mailing list