Supervising multiple gen_servers with same module / different arguments

Posted by Justin on Stack Overflow See other posts from Stack Overflow or by Justin
Published on 2010-04-15T16:04:45Z Indexed on 2010/04/15 18:23 UTC
Read the original article Hit count: 256

Filed under:
|

Hi,

I have a OTP application comprising a single supervisor supervising a small number of gen_servers. A typical child specification is as follows:

{my_server,
  {my_server, start_link, [123]},
  permanent, 
  5000, 
  worker,
  [my_server]}

No problems so far.

I now want to an add extra gen_server to the supervisor structure, using the same module Module/Fn as above, but different arguments, eg

{my_server_2,
  {my_server, start_link, [123]},
  permanent, 
  5000, 
  worker,
  [my_server_2]}

I thought this would work, but no:

=SUPERVISOR REPORT==== 15-Apr-2010::16:50:13 ===
     Supervisor: {local,my_sup}
     Context:    start_error
     Reason:     {already_started,<0.179.0>}
     Offender:   [{pid,undefined},
                  {name,my_server_2},
                  {mfa,{my_server,start_link,[]}},
                  {restart_type,permanent},
                  {shutdown,5000},
                  {child_type,worker}]

Do the module arguments in the second element of each child specification need to be different ?

Thanks,

Justin

© Stack Overflow or respective owner

Related posts about erlang

Related posts about otp