[erlang-questions] start_child() on simple_one_for_one supervisor -> {error, {already_started, ...}} ???

Dominic Williams erlang@REDACTED
Sun Dec 14 12:25:14 CET 2008

Hi mighty,

mighty a écrit :
> I have a basic simple_one_for_one supervisor that I cannot start
> multiple children from -- the first call to start_child() works, the
> second call to start_child() returns
> {error,{already_started,<0.38.0>}}. My supervisor is
> simple_one_for_one, so I'd expect to hit the ?is_simple() handling of
> start_child in supervisor.erl, which should go through
> supervisor:do_start_child_i() without any fuss, and definitely not
> return {error, {already_started, ...}} out of
> supervisor:handle_start_child().
 > [snipped...]

The problem is that you use the same name to register each 

Doing this in your my_node.erl works:

start_link(Instance) ->
   % ...
   Instance_s = integer_to_list(Instance),
   Name_s = ?MODULE_STRING ++ Instance_s,
   Name = list_to_atom (Name_s),
   gen_server:start_link({local, Name}, ?MODULE, [], []).


Dominic Williams

More information about the erlang-questions mailing list