[newbie] accept()-ing process under supervision (was:Erlangish way of Iterator pattern)

David Hopwood david.nospam.hopwood@REDACTED
Wed Jan 26 22:50:47 CET 2005


Joe Armstrong (AL/EAB) wrote:
> Tricky - there is a spectrum of answers here:
> 
> "make sure that it is always listening" could mean lot's of different things:
> 
> 	1) Is the listening process (ie the process which evaluates tcp_accept)
>                 still alive?
> 	2) Is the listening process responsive?
> 	    ie is it accepting connections and doing what it is supposed to do?
> 
> In my example tcp_server might happily accept connections and spawn a new handler
> per connection - but these handlers might deadlock, or go into infinite loops or something and not respond as
> expected (Now I don't mean here that the handlers *crash* - because crashes will be detected and the
> socket will be closed) - it's just that they don't work properly.
> 
> Detecting 1) is trivial (just link to the process). 2) requires some kind of end-to-end confirmation
> ie a program *outside* Erlang which periodically asks the server to prove that it running. 
> Say ask it what factorial 42 is once every minute.

Or better still, run the unit test for the server.

> <<to be really safe - the probing program should be on a *different* processor -
>     because of "Joe's law"
> 	
> 	+------------+
> 	| Joe's law |
> 	+-----------------------------------------+
> 	|  To do fault-tolerant computations |
>             | you need at least 2 computers      |
> 	+-----------------------------------------+
> 
>      Obviously :-)

I would have thought you could separate the problems of testing whether the
processor is working (must be done from a different processor), and testing
whether each program on it is working (can be done from the same processor,
provided it is from a different language runtime).

Processors and programs don't tend to fail in ways that could defeat this
approach.

-- 
David Hopwood <david.nospam.hopwood@REDACTED>




More information about the erlang-questions mailing list