Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:10:11+00:00 2026-06-15T03:10:11+00:00

I’m trying to build a supervisor tree where I have this structure: 1 root

  • 0

I’m trying to build a supervisor tree where I have this structure:

1 root supervisor -> 3 “level” supervisors -> each level supervisor has an initializer supervisor -> X number of workers (right now only 1 for the examples sake)

But for some reason starting the second level supervisor makes the whole tree terminate, if I only start 1 root -> 1 level -> 1 init -> 1 worker (or more workers) it’s fine, but as soon as I try to add more supervisors the tree terminates.

-module(otp_supervisor).
-behavior(supervisor).

-export([start_cell/1]).
-export([init/1]).

start_cell(root) ->
    supervisor:start_link({local, root}, ?MODULE, [root]);
start_cell({Type, Role}) ->
    supervisor:start_link({local, Type}, ?MODULE, [{Type, Role}]).

init([root]) -> 
    init_root(one_for_one, 3, 60);
init([{level, Param}]) -> 
    init_level(one_for_one, 3, 60, {member, Param});
init([{member, Param}]) -> 
    init_member(one_for_one, 3, 60, Param).

init_root(RestartStrategy, MaxRestart, MaxTime) ->
    io:format("~p ~s: Spawning...~n", [self(), root_supervisor]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {olevel,
                {otp_supervisor, start_cell, [{level, overseer}]},
                permanent, 1000, supervisor, [otp_supervisor]
            },
            {slevel,
                {otp_supervisor, start_cell, [{level, supervisor}]},
              permanent, 1000, supervisor, [otp_supervisor]
            },
            {wlevel,
                {otp_supervisor, start_cell, [{level, worker}]},
                permanent, 1000, supervisor, [otp_supervisor]
            }
        ]
        }
    }.

init_level(RestartStrategy, MaxRestart, MaxTime, {member, overseer}) ->
    io:format("~p ~s: Spawning...~n", [self(), overseer_level_supervisor]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {oinit,
                {otp_supervisor, start_cell, [{member, overseer}]},
                permanent, 1000, supervisor, [otp_supervisor]}
        ]
        }
    };
init_level(RestartStrategy, MaxRestart, MaxTime, {member, supervisor}) ->
    io:format("~p ~s: Spawning...~n", [self(), supervisor_level_supervisor]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {sinit,
                {otp_supervisor, start_cell, [{member, supervisor}]},
                permanent, 1000, supervisor, [otp_supervisor]}
        ]
        }
    };
init_level(RestartStrategy, MaxRestart, MaxTime, {member, worker}) ->
    io:format("~p ~s: Spawning...~n", [self(), worker_level_supervisor]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {winit,
                {otp_supervisor, start_cell, [{member, worker}]},
                permanent, 1000, supervisor, [otp_supervisor]}
        ]
        }
    }.

init_member(RestartStrategy, MaxRestart, MaxTime, overseer) ->
    io:format("~p ~s: Spawning...~n", [self(), init_overseer]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {ol_core,
                {aux_datasocket, start, [ol_overseer1]},
                permanent, 1000, worker, [aux_datasocket]
            }
        ]
        }
    };
init_member(RestartStrategy, MaxRestart, MaxTime, supervisor) ->
    io:format("~p ~s: Spawning...~n", [self(), init_supervisor]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {sl_core,
                {aux_datasocket, start, [sl_overseer1]},
                permanent, 1000, worker, [aux_datasocket]
            }
        ]
        }
    };
init_member(RestartStrategy, MaxRestart, MaxTime, worker) ->
    io:format("~p ~s: Spawning...~n", [self(), init_worker]),
    {ok, {
        {RestartStrategy, MaxRestart, MaxTime},
        [
            {wl_core,
                {aux_datasocket, start, [wl_overseer1]},
                permanent, 1000, worker, [aux_datasocket]
            }
        ]
        }
    }.

The aux_datasocket module is a very simple gen_server that works perfectly fine by itself (as it does nothing but start up the gen_server right now) so I am positive the error does not lie in that module.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:10:12+00:00Added an answer on June 15, 2026 at 3:10 am

    Guess: You are making multiple registrations of the same supervisor with the {local, Type} registration point. The way to debug this is to run rel -boot start_sasl and then look for the crash/progress reports and try to figure out what is wrong. The multiplicity-problem suggests this is what is wrong.

    Another important thing is that running this from the shell links the tree to the shell. So if you end up killing the shell due to an error, poof goes the supervisor tree as well. You need to move it out of the linked network:

    Pid = spawn(fun() -> {ok, _} = supervisor_tree_start(), receive stop -> ok end end),
    ...
    Pid ! stop.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I have an array which has BIG numbers and small numbers in it. I
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.