Umbrella dependency in_umbrella: true causing cycles in the dependency graph

I have been seeing some weird and intermittent errors in my Umbrella applications lately (like Phoenix instrumenters from one umbrella child app trying to info a Phoenix instrumenter from another umbrella child app)

But first thing - shouldn’t this work?

App1 's mix.exs

defp deps do
    [
...
     {:app2, in_umbrella: true},
...
   ]
  end

App2 's mix.exs

defp deps do
    [
...
     {:app1, in_umbrella: true},
...
   ]
  end

It is currently causing ** (Mix) Could not sort dependencies. There are cycles in the dependency graph - even if the the child apps do not have any of the same deps.

OS: macOS 10.14.3

$ elixir -v

Erlang/OTP 21 [erts-10.3.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.1 (compiled with Erlang/OTP 21)

No, circular dependency graphs are not supported, you need to break the cycle such that the beam knows which application has to be started first.

3 Likes

The beam starts applications in the order the dependency tree requires and circular dependencies break the ability to do so. App1 would need App2 to be started first, while App2 would need App1 to be started first.