Supervision Trees - A Beginner Writes
Gordon Guthrie, BTP, BT, SE
Thu Jan 15 14:32:12 CET 2004
> -----Original Message-----
> From: Bengt Kleberg [mailto:Bengt.Kleberg@REDACTED]
> Sent: 15 January 2004 12:33
> To: erlang-questions@REDACTED
> Subject: Re: Supervision Trees - A Beginner Writes
> Gordon Guthrie, BTP, BT, SE wrote:
> > Folks
> > I am writing my first supervision tree. I have an application which
> > starts a simple one-for-one supervisor.
> is this a ''one-for-one'' supervisor that happens to be
> simple? or is it
> ''simple-one-for-one'' as per OTP Design Principles, 5.9
'simple-one-for-one' as per the spec
> > This supervisor starts workers. The intention is that each
> worker will
> > eventually handle an http session, so I am starting them as
> > transients. These processes will die when the user session they
> > support times out, so each worker spawns a linked timeout process
> > which periodically messages its worker "if you haven't done
> > since last time then exit".
> > The problem I have is that when the worker exits (either
> normal or a
> > custom timeout message) the supervisor and then the
> application both
> > exit.
> according to the manual a transient child process should
> behave differently it it exits with an abnormnal exit (vs a
> normal exit). are you getting the same thing?
I tried exiting with exit(normal) and exit("normal timeout") - the second
being (what I think is) an abnormal exit.
> > I can see that there might be circumstances that would kill
> a worker
> > in which a supervisor might also want to terminate for a clean
> > restart.
> it is only if you have more than MaxR number of restarts occur in the
> last MaxT seconds (as per OTP Design Principles, 5.4), that the
> supervisor terminates. or if the supervisiors supervisior
I used the default values of the Emacs skeleton for MaxR and MaxT (it's on
the other machine at the moment, I can't check just now, but I will).
> > So my question is how do I (under OTP) handle the exit message that
> > results from the spawn_link to the child. In a 'homebrew'
> > tree (ie last
> > week) I would have just trapped exits...
> imho the supervision behaviour should handle this for you.
That's what I thought... and that the supervisor wouldn't propogate the exit
up to the application
Scottish Enterprise Network
Address & Contact Numbers
5 Atlantic Quay
Tel: +44 (0)141 248 2700.
Fax: +44 (0)141 221 3217
message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
More information about the erlang-questions