processone / processone/ejabberd

Errors when compiling ejabberd in Phoenix project

Open
#3,240 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component:Elixir
Dominant language
Erlang
Stars
6.7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing mix do deps.get, compile with the ejabberd dependency enabled, then compare it with the clean-build workaround described in the issue. Inspect mix.exs and the reported failure path in lib/mix/tasks/compile.phoenix.ex; done means the dependencies compile together and mix ecto.setup or mix phx.start no longer raises the telemetry process error.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, erlang
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.