Skip to content

Intermittent: (EXIT) shutdown: failed to start child: ConCache.LockSupervisor #80

@krisleech

Description

@krisleech

When I run my tests or start iex I sometimes get the following error:

** (Mix) Could not start application export: Export.Application.start(:normal, []) returned an error: shutdown: failed to start child: ConCache
    ** (EXIT) shutdown: failed to start child: ConCache.LockSupervisor
        ** (EXIT) an exception was raised:
            ** (ArgumentError) unknown registry: ConCache
                (elixir 1.17.1) lib/registry.ex:1400: Registry.key_info!/1
                (elixir 1.17.1) lib/registry.ex:237: Registry.whereis_name/2
                (stdlib 5.2.3) gen.erl:107: :gen.start/6
                (stdlib 5.2.3) supervisor.erl:420: :supervisor.do_start_child_i/3
                (stdlib 5.2.3) supervisor.erl:406: :supervisor.do_start_child/2
                (stdlib 5.2.3) supervisor.erl:390: anonymous fn/3 in :supervisor.start_children/2
                (stdlib 5.2.3) supervisor.erl:1258: :supervisor.children_map/4
                (stdlib 5.2.3) supervisor.erl:350: :supervisor.init_children/2

It is intermittent, and typically if I run the tests again there is no error.

This is how is setup:

defmodule Export.Application do
  @moduledoc false

  use Application

  @impl true
  def start(_type, _args) do
    children = [
      Export.Scheduler,
      {
        ConCache,
        [
          name: :payment_method_cache,
          ttl_check_interval: :timer.seconds(5),
          global_ttl: :timer.minutes(10),
          touch_on_read: true
        ]
      }
    ]

    opts = [strategy: :one_for_one, name: Export.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

defmodule Export.MixProject do
  use Mix.Project

  # ...

  def application do
    [
      extra_applications: [:logger, :con_cache],
      mod: {Export.Application, []}
    ]
  end
end

As per the docs I tried to add :con_cache to applications but I got a warning, I think extra_applications is now correct.

Any thoughts much appreciated ❤️

I noticed I also sometimes see: ** (Mix) Could not start application con_cache: could not find application file: con_cache.app, again this goes away on retry.

It also never seems to happen on CI.

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