Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple_one_for_one start_child() returns already_started

I have a supervisor which should start simple_one_for_one workers. When I call start_child() for the first time, everything goes excellent. But, when I do it the second time, I get {error,{already_started,<0.71.0>}}. Why would simple_one_for_one supervisor return me a already_started? What am I missing?

Here is the code: supervisor, worker.

like image 278
dijxtra Avatar asked Jul 23 '11 06:07

dijxtra


1 Answers

you are registering a (local) name for your gen_server. once you start one, you can not start another one with the same name.

if you use gen_server:start_link/3 instead, removing the first argument from your current gen_server:start_link/4 call, you should be able to start up more than one.

like image 98
butter71 Avatar answered Sep 30 '22 09:09

butter71