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

Ameretat Reith <>
Tue Sep 8 10:04:58 CEST 2015


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


More information about the erlang-questions mailing list