[erlang-questions] supervisor woes

Jared Nance <>
Wed Sep 8 21:16:07 CEST 2010


Hi Adam-
Here's the definition of ios_faux_card:start_link/1

start_link(CardSlot) when is_atom(CardSlot) ->
	gen_server:start_link({local,CardSlot}, ?MODULE, [CardSlot,2], []).

Is this the problem?

JN

On Sep 8, 2010, at 11:59 AM, Adam Kocoloski wrote:

> On Sep 8, 2010, at 11:36 AM, Jared Nance wrote:
> 
>> Hello List-
>> Thanks in advance for whatever help you can offer.  I'm putting together a supervision tree which is rather simple - at the moment, there is a supervisor that manages several other supervisors, and those supervisors each manage only worker nodes.  The problem I am having is with one of my supervisors which manages 4 worker nodes.  Each node is a gen_server that uses the same callback module, but with different arguments to start_link.  The childspec for the worker nodes looks like
>> 
>> {cardA, {ios_faux_card, start_link, [cardA]}, permanent, brutal_kill, worker, [ios_faux_card]}
>> 
>> and so the supervisor for these workers is started with a child spec that looks like
>> 
>> {{one_for_one, 5, 10}, [{ios_card_super, {ios_card_super, start_link, [{cardA, {ios_faux_card, start_link, [cardA]}, permanent, brutal_kill, worker, [ios_faux_card]}], permanent, infinity, supervisor, [ios_card_super]}
>> 
>> and that works just fine.  the problem arises when i try to add a second (or third, or fourth) gen_server to the list of processes that the ios_card_super is supervising.  if i try starting it with this child spec instead:
>> 
>> {{one_for_one, 5, 10}, [{ios_card_super, {ios_card_super, start_link, [{cardA, {ios_faux_card, start_link, [cardA]}, permanent, brutal_kill, worker, [ios_faux_card]},{cardB,{ios_faux_card, start_link, [cardB]}, permanent, brutal_kill, worker, [ios_faux_card]}], permanent, infinity, supervisor, [ios_card_super]}
>> 
>> it refuses to start.  what's more, the only response I get out of it is {error, shutdown}.  I have put io:format debug statements in the ios_faux_card module and it's clear that start_link/1is never being called when there are 2+ workers to supervise.
>> 
>> Thanks for whatever help you can offer on this very frustrating issue.
>> 
>> Jared N
> 
> Hi Jared, you wouldn't happen to be trying to register the process in ios_faux_card, would you?
> 
> Adam
> 
> 
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
> 



More information about the erlang-questions mailing list