[erlang-questions] simple_one_for_one supervisor - what happens at restart? (also: gen_tcp)

Chandru chandrashekhar.mullaparthi@REDACTED
Tue May 17 22:09:14 CEST 2016


On 17 May 2016 at 00:49, Fred Hebert <mononcqc@REDACTED> wrote:

> On 05/16, Chandru wrote:
>
>>
>> No, it's not. The reason a terminate callback is provided in a gen_server
>> is so that a process can clean up when it terminates, not to delegate it
>> to
>> other processes.
>>
>>
> I'm gonna side with Loďc here. The terminate callback is good for any
> process-local cleanup or optimistic work, but is by no means a safe way to
> terminate anything.
>
> For example, if you have many children to terminate and through some
> interleaving brutall_kill is triggered (or anyone calls exit(Pid, kill)),
> whatever work you wanted to do in terminate will be skipped by a
> non-trappable exit signal.
>

Agreed, but how does adding the connection handling process (in Oliver's
use case) to a simple_one_for_one supervisor help? It doesn't give him
anything other than the illusion of being "supervised".

Chandru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160517/163c95a1/attachment.htm>


More information about the erlang-questions mailing list