[erlang-questions] simple_one_for_one supervisor, transient restart strategy

Paul Peregud paulperegud@REDACTED
Fri Dec 14 13:40:04 CET 2012


I've distilled the code to minimal form. And the error is no longer
there. So it seems that I misdiagnosed the source of the problem.
Anyway - here is the code:

test case:
http://pastebin.com/80JbEE0k

supervisor:
http://pastebin.com/kyy7pnjq

worker:
http://pastebin.com/q5QQ3WM3

On Thu, Dec 13, 2012 at 4:06 PM, Arif Ishaq <arif.ishaq@REDACTED> wrote:
>
> Hi,
>
> I have tried this with R15B and it works for me.
>
> In practice, I have the child implemented as a gen_server which handles messages stopnormal, stopshutdown and stopabort treated with {stop, normal, State}, {stop, shutdown, State} and {stop, abort, State} respectively. When I send the messages stopnormal or stopshutdown, the child dies without getting restarted. When I send a stopabort, it gets restarted with the arguments with which it was created.
>
> Can you please post your code to see what went wrong?
>
> Regards
> Arif
>
>
> -----Original Message-----
> From: Paul Peregud [mailto:paulperegud@REDACTED]
> Sent: mercoledì 12 dicembre 2012 16.20
> To: erlang-questions@REDACTED
> Subject: [erlang-questions] simple_one_for_one supervisor, transient restart strategy
>
> I've searched mailing list for this question and found nothing.
>
> There is this one peculiar behavior when you use simple_one_for_one with transient strategy. You do supervisor:start_child(Ref, Args), the child executes and if it dies gracefully everything is fine, child is removed from supervisor tree. However, if it fails, it is restarted WITHOUT Args.
>
> This combination of type/strategy would be a great tool for fire-and-forget tasks if it was not for that small issue.
>
> Is it a bug or is it a feature?
>
> --
> Best regards,
> Paul Peregud
> +48602112091
>



-- 
Best regards,
Paul Peregud
+48602112091



More information about the erlang-questions mailing list