:observer.start() don't show worked started by DynamicSupervisor

Here is the worked started by the supervisor
iex(13)> DynamicSupervisor.which_children(Player.Sup)
[
{:undefined, #PID<0.185.0>, :worker, [Ddz.Player]},
{:undefined, #PID<0.400.0>, :worker, [Ddz.Player]},
{:undefined, #PID<0.17547.0>, :worker, [Ddz.Player]}
]
Here is observer display

Why the worker process not displayed?
Thanks for help on this !

Can you check the ancestors of the workers?

Process.info(pdi("0.185.0"))


[
  current_function: {Process, :info, 1},
  initial_call: {:proc_lib, :init_p, 5},
  status: :running,
  message_queue_len: 0,
  links: [],
  dictionary: [
    "$initial_call": {IEx.Evaluator, :init, 4},
    "$ancestors": [#PID<0.82.0>],
    iex_evaluator: :ack,
    iex_history: %IEx.History{queue: {[{1, nil}], []}, size: 1, start: 1},
    iex_server: #PID<0.82.0>
  ],
  trap_exit: false,
  error_handler: :error_handler,
  priority: :normal,
  group_leader: #PID<0.65.0>,
  total_heap_size: 8370,
  heap_size: 4185,
  stack_size: 45,
  reductions: 6189,
  garbage_collection: [
    max_heap_size: %{error_logger: true, kill: true, size: 0},
    min_bin_vheap_size: 46422,
    min_heap_size: 233,
    fullsweep_after: 65535,
    minor_gcs: 2
  ],
  suspending: []
]

IIRC, if the ancestors data structure shows up empty, it may mean they are not being linked correctly to you supervisor.

You can also try resizing the window :smiley:

1 Like

Hi @leiding!

Do you perhaps have a small application that shows the problem?

The issue might perhaps even be because of starting the children the wrong way…

Thanks guys, Resize not work, and ancestors shows correctly. Still digging, will update result once I got the answer :slight_smile:

iex(2)> {:ok,pid} =DynamicSupervisor.start_child(Player.Sup,{Ddz.Player, Player1})
{:ok, #PID<0.429.0>}
iex(3)> Process.info(pid)
[
  registered_name: Player1,
  current_function: {:gen_server, :loop, 7},
  initial_call: {:proc_lib, :init_p, 5},
  status: :waiting,
  message_queue_len: 0,
  links: [],
  dictionary: [
    "$initial_call": {Ddz.Player, :init, 1},
    "$ancestors": [Player.Sup, Cards, #PID<0.248.0>]
  ],
  trap_exit: false,
  error_handler: :error_handler,
  priority: :normal,
  group_leader: #PID<0.247.0>,
  total_heap_size: 233,
  heap_size: 233,
  stack_size: 10,
  reductions: 69,
  garbage_collection: [
    max_heap_size: %{error_logger: true, kill: true, size: 0},
    min_bin_vheap_size: 46422,
    min_heap_size: 233,
    fullsweep_after: 65535,
    minor_gcs: 0
  ],
  suspending: []
]

Are you creating dynamic supervisors as specified in this guide?

If you follow its instructions, you should have a DynamicSupervisor whose children show up in :observer.start. Then you can compare where your code differs from the one in the examples.

Hello everyone,

I have the exact same issue as @leiding. I use elixir 1.9.0 OTP 22. Any news about this ?

I made an example and took a screenshot. Perhaps it can provides complementary information.

Thanks !

:wave:

Can you publish the example on github for us to take a look?

Sure, here’s the link https://github.com/MrPwet/dynamic-supervisor-example

Can you try replacing it with start_link?

2 Likes

That solved my issue, indeed. Rookie mistake, I guess…

Thank you for your time !

1 Like