[erlang-questions] Cannot add supervisor to application's supervisor in runtime

Siri Hansen erlangsiri@REDACTED
Tue Sep 8 15:42:38 CEST 2015


Can you see if your app_sup:init function is called during the upgrade? It
should be called from supervisor:code_change/3 as a result of this
instruction: {code_change,up,[{app_sup,[]}]}. What does it return?
Unfortunately the real time error reporting here is not very good.

Do the code paths look correct after the upgrade?

Regards
/siri@REDACTED


2015-09-08 10:04 GMT+02:00 Ameretat Reith <ameretat.reith@REDACTED>:

> Hi,
>
> I'm trying to add new supervisor `ch_sup` and It's worker `ch` to
> an application supervisor `app_sup` with this appup:
>
> ```
> {"0.1.3",
>  [{"0.1.2",
>    [{add_module, ch},
>     {add_module, ch_sup},
>     {update, app_sup, supervisor},
>     {apply, {supervisor, restart_child, [app_sup, ch_sup]}}
>    ]
>  }],
>  [{"0.1.2",
>    [{apply, {supervisor, terminate_child, [app_sup, ch_sup]}},
>     {apply, {supervisor, delete_child, [app_sup, ch_sup]}},
>     {update, app_sup, supervisor},
>     {delete_module, ch_sup},
>     {delete_module, ch}
>    ]
>  }]
> }.
> ```
>
> And this relup generated by systools:make_relup:
>
> ```
> {"0.0.3",
>  [{"0.0.2",[],
>    [{load_object_code,{app,"0.1.3",
>                                   [ch,ch_sup,app_sup]}},
>     point_of_no_return,
>     {load,{ch,brutal_purge,brutal_purge}},
>     {load,{ch_sup,brutal_purge,brutal_purge}},
>     {suspend,[app_sup]},
>     {load,{app_sup,brutal_purge,brutal_purge}},
>     {code_change,up,[{app_sup,[]}]},
>     {resume,[app_sup]},
>     {apply,{supervisor,restart_child,[app_sup,ch_sup]}}]}],
>  [{"0.0.2",[],
>    [{load_object_code,{app,"0.1.2",[app_sup]}},
>     point_of_no_return,
>     {apply,{supervisor,terminate_child,[app_sup,ch_sup]}},
>     {apply,{supervisor,delete_child,[app_sup,ch_sup]}},
>     {suspend,[app_sup]},
>     {load,{app_sup,brutal_purge,brutal_purge}},
>     {code_change,down,[{app_sup,[]}]},
>     {resume,[app_sup]},
>     {remove,{ch_sup,brutal_purge,brutal_purge}},
>     {purge,[ch_sup]},
>     {remove,{ch,brutal_purge,brutal_purge}},
>     {purge,[ch]}]}]}.
> ```
>
> New release installs But app_sup's child spec wont change, neither
> ch_sup start until I terminate app_sup and start It again with
> `supervisor:restart_child(real_app_sup, app_sup)`. app is an
> included application which is put in real_app's supervision tree. I
> don't think app as an included application, should be regarded
> special here, since I use It just as a supervisor. But seems I'm wrong..
>
> So, What is the problem? Can I achieve changing app_sup's main
> supervisor without restarting It's process?
>
> Thanks
> _______________________________________________
> 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/20150908/24018af2/attachment.htm>


More information about the erlang-questions mailing list