Skip to content

[ch09] - ProcessRegistry restarts crash the App #23

@ajayvigneshk

Description

@ajayvigneshk

In Chapter 09, section 9.1, the following code on iex

Todo.System.start_link
Process.exit(Process.whereis(Todo.ProcessRegistry),:kill)

causes the Supervisor to crash(after trying to restart the children). Trying to inspect the result of Registry.start_link, it shows

{:error,
 {:shutdown,
  {:failed_to_start_child, Todo.ProcessRegistry.PIDPartition0,
   {:already_started, #PID<0.183.0>}}}}

Am guessing that this happens because the supervisor is starting ProcessRegistry in succession before the actual Registry is shutdown and keeps erroring 3 times, ending up in shutdown.
Is that correct?
How to handle this scenario gracefully?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions