[erlang-questions] Stopping a supervisor running under a supervisor
Chris Clark
boozelclark@REDACTED
Thu Jan 22 16:54:36 CET 2015
Thank you all very much for your assistance. With the help of the members
of the mailing list I managed to get this issue solved.
The children are transient.
My problem was that the workers (w1, w2 ...) and the serv were being killed
and they were logging the errors. I managed to work around this by first
sending a shutdown command to the workers and then using a timer:apply
after to stop the supervisors in my tree after some time essentially giving
the workers and serv a time-out to shutdown or be killed.
Thank you all for your assistance.
On Fri, Jan 16, 2015 at 2:07 PM, Jesper Louis Andersen <
jesper.louis.andersen@REDACTED> wrote:
> I'd go with a solution where you mark the children as 'transient' and then
> build code inside them to stop gracefully. That way, if the termination is
> due to a 'normal' exit, there should be no indication of anything in the
> log files.
>
> On Tue Jan 06 2015 at 4:32:01 PM Chris Clark <boozelclark@REDACTED>
> wrote:
>
>> Hi Sean
>>
>> supervisor:terminate_child/2 does work however it causes errors in my
>> logs so i am looking for a way to gracefully terminate the children.
>>
>> Thanks
>>
>> On Tue, Jan 6, 2015 at 4:20 PM, Sean Cribbs <sean@REDACTED> wrote:
>>
>>> Did you try supervisor:terminate_child/2?
>>>
>>> On Mon, Jan 5, 2015 at 11:44 PM, Chris Clark <boozelclark@REDACTED>
>>> wrote:
>>>
>>>> Hi Antonio
>>>>
>>>> Thanks for the assistance. From what I have read a supervisor should
>>>> stop if it is sent a shutdown signal using exit(Pid, shutdown). but it
>>>> will only accept that signal from its parent process in an OTP application.
>>>> I tried creating a function in the parent supervisor(my_supersup)
>>>> stop_child(Pid) that then sends the exit(pid, shutdown) signal and then
>>>> call that from the shell but that doesn't seem to stop it either.
>>>>
>>>> Thanks,
>>>>
>>>> On Tue, Dec 30, 2014 at 11:47 PM, Antonio Dias <
>>>> antonio.r.dias@REDACTED> wrote:
>>>>
>>>>> Hi, i'm fairly new to Erlang also, but can't you send a 'stop' message
>>>>> and use that to stop the process?
>>>>>
>>>>> ADias
>>>>>
>>>>> On Thu, Dec 11, 2014 at 10:40 AM, Chris Clark <boozelclark@REDACTED>
>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I am fairly new to erlang and have a question regarding properly
>>>>>> stopping a supervisor that resides directly under another supervisor.
>>>>>>
>>>>>> My application consist of a top level supervisor (my_supersup) which
>>>>>> is a simple_one_for_one supervisor of other supervisors my_sup. Each my_sup
>>>>>> supervises a gen_server, serv and another supervisor that is also a
>>>>>> simple_one_for_one supervisor of some workers
>>>>>>
>>>>>> my_supersup
>>>>>> (simple_one_for_one, transient)
>>>>>> |
>>>>>> |_______ ...
>>>>>> |
>>>>>> my_sup (one_for_all, transient)
>>>>>> |________________
>>>>>> | |
>>>>>> | serv
>>>>>> worker_sup
>>>>>> (simple_one_for_one, transient)
>>>>>> |___________ ...
>>>>>> | |
>>>>>> w1 w2
>>>>>>
>>>>>> How do shutdown an instance of my_sup gracefully without killing it.
>>>>>> At present I can do it with supervisor:terminate_child and
>>>>>> supervisor:delete_child but I would like them to shutdown rather than be
>>>>>> killed if possible?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> erlang-questions@REDACTED
>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>>
>>>
>>>
>>> --
>>> Sean Cribbs <sean@REDACTED>
>>> Sr. Software Engineer
>>> Basho Technologies, Inc.
>>> http://basho.com/
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150122/c630e57d/attachment.htm>
More information about the erlang-questions
mailing list