Flexible, fast and powerful supervisor library for Erlang processes.
'count'=>infinity
and element restart
in your plan.Childspec = #{id => foo ,start => {bar, baz, [arg1, arg2]} ,plan => [restart] ,count => infinity}.
If your process did not start after crash, director will lock and retries to restart your process infinity
times !
If you are using infinity
for 'count'
, always use {restart, MiliSeconds}
in 'plan'
instead of restart
.
Childspec1 = #{id => foo ,start => {bar, baz} ,plan => [restart,restart,delete,wait,wait, {restart, 4000}] ,count => infinity}. Childspec2 = #{id => foo ,start => {bar, baz} ,plan => [restart,restart,stop,wait, {restart, 20000}, restart] ,count => infinity}. Childspec3 = #{id => foo ,start => {bar, baz} ,plan => [restart,restart,stop,wait, {restart, 20000}, restart] ,count => 0}. Childspec4 = #{id => foo ,start => {bar, baz} ,plan => [] ,count => infinity}.
The rest of delete
element in Childspec1
and the rest of stop
element in Childspec2
will never evaluate!
In Childspec3
you want to run your plan 0 times!
In ChildSpec4
you have not any plan to run infinity
times!
release_handler
, release_handler
calls supervisor:get_callback_module/1
for fetching its callback module.get_callback_module/1
uses supervisor internal state record for giving its callback module. Our director does not know about supervisor internal state record, then supervisor:get_callback_module/1
does not work with directors.supervisor:get_callback_module/1
works perfectly with directors :).1> foo:start_link(). {ok,<0.105.0>} 2> supervisor:get_callback_module(foo_sup). foo 3>