ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

Errors when compiling ejabberd in Phoenix project

Open ghost opened this issue 4 years ago • 4 comments

Environment

  • ejabberd version: 20.3.0
  • Erlang version: Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.7.1
  • OS: Linux (Fedora 32)
  • Installed from: Hex
  • Phoenix: 1.5.1

Bug description

I am embedding ejabberd in an Elixir Phoenix project. Running mix do deps.get, compile throws an error towards the end of compiling:

==> phoenix_live_reload
Compiling 4 files (.ex)
Generated phoenix_live_reload app
==> phoenix_ecto
Compiling 7 files (.ex)
Generated phoenix_ecto app

19:07:52.085 [info]  Application phoenix exited: exited in: Phoenix.start(:normal, [])
    ** (EXIT) exited in: :gen_server.call(:telemetry_handler_table, {:insert, {Phoenix.Logger, [:phoenix, :channel_handled_in]}, [[:phoenix, :channel_handled_in]], #Function<8.100890372/4 in Phoenix.Logger.install/0>, :ok})
        ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started

19:07:52.086 [info]  Application eex exited: :stopped
** (MatchError) no match of right hand side value: {:error, {:phoenix, {:bad_return, {{Phoenix, :start, [:normal, []]}, {:EXIT, {:noproc, {:gen_server, :call, [:telemetry_handler_table, {:insert, {Phoenix.Logger, [:phoenix, :channel_handled_in]}, [[:phoenix, :channel_handled_in]], #Function<8.100890372/4 in Phoenix.Logger.install/0>, :ok}]}}}}}}}
    (phoenix) lib/mix/tasks/compile.phoenix.ex:11: Mix.Tasks.Compile.Phoenix.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.all.ex:73: Mix.Tasks.Compile.All.run_compiler/2
    (mix) lib/mix/tasks/compile.all.ex:53: Mix.Tasks.Compile.All.do_compile/4
    (mix) lib/mix/tasks/compile.all.ex:24: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
    (mix) lib/mix/tasks/compile.all.ex:40: Mix.Tasks.Compile.All.with_logger_app/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.ex:96: Mix.Tasks.Compile.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (elixir) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:783: Enum.each/2
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2
    (elixir) lib/code.ex:813: Code.require_file/2

After this, commands like mix ecto.setup or mix phx.start throw the same error.

There is a workaround:

  • clean out the _build and deps folders
  • comment out the ejabberd dependency in mix.exs
  • run mix do deps.get, compile
  • uncomment the ejabberd dependency
  • run mix do deps.get, compile again

Then everything works as expected! So for some reason, compiling the ejabberd at the same time as the rest of the project breaks it. I have no idea how to debug this further, but perhaps someone here can point me in the right direction?

(This same project was raised back in September 2019 on the Elixir forums, but no-one opened a Github issue).

ghost avatar Apr 28 '20 18:04 ghost

Hi, I have faced the same issue. But if you're using the latest phoenix app then you check you must check your elixir version.

siddhant3030 avatar May 07 '20 10:05 siddhant3030

The issue occcurs on the latest stable version of Elixir:

❯ elixir --version
Erlang/OTP 22 [erts-10.7.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.10.3 (compiled with Erlang/OTP 22)

ghost avatar May 12 '20 13:05 ghost

I'm facing the same issue and I'm lost about how to start the debugging. Could anyone shed some light on this? :/

Environement

  • Ejabberd version: 18.12.1
  • Erlang/OTP 22
  • Elixir 1.8.2
  • Phoenix: 1.5.3
19:55:24.081 [info]  Application phoenix exited: exited in: Phoenix.start(:normal, [])
    ** (EXIT) exited in: :gen_server.call(:telemetry_handler_table, {:insert, {Phoenix.Logger, [:phoenix, :channel_handled_in]}, [[:phoenix, :channel_handled_in]], #Function<8.34479898/4 in Phoenix.Logger.install/0>, :ok})
        ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started

19:55:24.084 [info]  Application eex exited: :stopped
==> http_server
could not compile dependency :http_server, "mix compile" failed. You can recompile this dependency with "mix deps.compile http_server", update it with "mix deps.update http_server" or clean it with "mix deps.clean http_server"
** (MatchError) no match of right hand side value: {:error, {:phoenix, {:bad_return, {{Phoenix, :start, [:normal, []]}, {:EXIT, {:noproc, {:gen_server, :call, [:telemetry_handler_table, {:insert, {Phoenix.Logger, [:phoenix, :channel_handled_in]}, [[:phoenix, :channel_handled_in]], #Function<8.34479898/4 in Phoenix.Logger.install/0>, :ok}]}}}}}}}
    (phoenix) lib/mix/tasks/compile.phoenix.ex:11: Mix.Tasks.Compile.Phoenix.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.all.ex:68: Mix.Tasks.Compile.All.run_compiler/2
    (mix) lib/mix/tasks/compile.all.ex:52: Mix.Tasks.Compile.All.do_compile/4
    (mix) lib/mix/tasks/compile.all.ex:23: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
    (mix) lib/mix/tasks/compile.all.ex:39: Mix.Tasks.Compile.All.with_logger_app/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.ex:96: Mix.Tasks.Compile.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/deps.compile.ex:156: anonymous fn/2 in Mix.Tasks.Deps.Compile.do_mix/2
    (mix) lib/mix/project.ex:348: Mix.Project.in_project/4
    (elixir) lib/file.ex:1506: File.cd!/2
    (mix) lib/mix/dep.ex:269: Mix.Dep.in_dependency/3
    (mix) lib/mix/tasks/deps.compile.ex:74: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/tasks/deps.compile.ex:64: Mix.Tasks.Deps.Compile.compile/2
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

diogommartins avatar Aug 23 '20 23:08 diogommartins

compiling the ejabberd at the same time as the rest of the project breaks it.

I know almost nothing about Phoenix, but maybe ejabberd adds some conflicting dependency with other parts of Phoenix?

Anyway, is this problem still present, using recent versions of Erlang, Elixir, Phoenix and ejabberd?

badlop avatar Jul 16 '21 15:07 badlop