phoenixframework / phoenix_live_dashboard

Realtime dashboard with metrics, request logging, plus storage, OS and VM insights

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling fails the first time

marcandre opened this issue · comments

Environment

Make sure you are using the latest LiveView and Dashboard versions before continuing.

  • Elixir version (elixir -v): 1.12.x
  • Phoenix version (mix deps): 1.6.0
  • Phoenix LiveView version (mix deps): 0.16.4
  • Phoenix Dashboard version (mix deps): 0.5.0

Actual behavior

Sorry, I'm not sure where to file this, nor under what conditions exactly, but after updating phoenix_live_dashboard, I get a compilation error when I recompile all my dependencies, and compiling again succeeds.

$ mix compile
[...]
==> phoenix
Compiling 68 files (.ex)
Generated phoenix app
==> phoenix_live_view
Compiling 28 files (.ex)
Generated phoenix_live_view app

12:47:27.990 [info]  Application plug exited: exited in: Plug.Application.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function Plug.Application.start/2 is undefined (module Plug.Application is not available)
            (plug 1.12.1) Plug.Application.start(:normal, [])
            (kernel 8.0) application_master.erl:293: :application_master.start_it_old/4

12:47:28.067 [info]  Application telemetry exited: :stopped

12:47:28.069 [info]  Application plug_crypto exited: :stopped

12:47:28.070 [info]  Application mime exited: :stopped

12:47:28.070 [info]  Application eex exited: :stopped
==> phoenix_live_dashboard
could not compile dependency :phoenix_live_dashboard, "mix compile" failed. You can recompile this dependency with "mix deps.compile phoenix_live_dashboard", update it with "mix deps.update phoenix_live_dashboard" or clean it with "mix deps.clean phoenix_live_dashboard"
** (MatchError) no match of right hand side value: {:error, {:plug, {:bad_return, {{Plug.Application, :start, [:normal, []]}, {:EXIT, {:undef, [{Plug.Application, :start, [:normal, []], []}, {:application_master, :start_it_old, 4, [file: 'application_master.erl', line: 293]}]}}}}}}
    (phoenix 1.6.2) lib/mix/tasks/compile.phoenix.ex:19: Mix.Tasks.Compile.Phoenix.run/1
    (mix 1.12.1) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.12.1) lib/mix/tasks/compile.all.ex:90: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.12.1) lib/mix/tasks/compile.all.ex:70: Mix.Tasks.Compile.All.compile/4
    (mix 1.12.1) lib/mix/tasks/compile.all.ex:57: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.12.1) lib/mix/tasks/compile.all.ex:35: Mix.Tasks.Compile.All.run/1
    (mix 1.12.1) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.12.1) lib/mix/tasks/compile.ex:128: Mix.Tasks.Compile.run/1

Compiling another time works:

$ mix compile
==> phoenix_live_dashboard
Compiling 40 files (.ex)
Generated phoenix_live_dashboard app
==> ...

You are using an unreleased Elixir, right? Can you please try "master" or "1.12.3" and let me know if the issue exists? There has been fixes to the compilation work we have been doing and I think this is related.

Another idea is for you to try compiling https://github.com/phoenixframework/plds/ - it works fine for me with Elixir master after upgrading to latest dashboard and recompiling from scratch.

I'm running from the 1.12 branch for now, as we have one dependency that isn't yet compatible with 1.13. Still, let's close this and I will reopen if I can get a systematic way to reproduce it. Also we had issues with our releases and bumping the dashboard to 0.5.3 seems to fix it, so maybe that's related.
Thanks

Hello, I have the same issue and I can reproduce.

Just do the following:

mix phx.new hello_phoenix
cd hello_phoenix
rm mix.lock
mix deps.clean --all
mix deps.get
mix compile

My setup is the following:

elixir -v                                                                                                                                                        [130]
Erlang/OTP 24 [erts-12.3.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

Thanks for sharing but unfortunately I still cannot reproduce the issue. :( After you ran the script above, which version of phoenix_live_dashboard you got?

I couldn't reproduce either, and I have not noticed that bug again, despite some full recompilation of our project.

Ok, I fix it.

I created a Dockerfile to reproduce the issue in isolation, I'm using a macos but I'm not sure about what I have installed.
While testing the Dockerfile i notice that an error appear about rebar so, in the Dockerfile, I added mix local.rebar and everything works!

So I run mix local.rebar on my machine also and now I can't reproduce the issue.
The mix local.rebar solves the issue.

Thanks for answering me so fast! This is a great community