neel-desh

neel-desh

Application Crashing with Runtime Error in Elixir 1.17.2

Start Call: :disk_log_sup.start_link()
12:52:11.524 [info] Child :disk_log_server of Supervisor :kernel_safe_sup started
Pid: #PID<0.3050.0>
Start Call: :disk_log_server.start_link()
{exit,terminating,[{application_controller,call,2,[{file,"application_controller.erl"},{line,511}]},{application,enqueue_or_start,6,[{file,"application.erl"},{line,380}]},{application,ensure_all_started,3,[{file,"application.erl"},{line,359}]},{elixir,start_cli,0,[{file,"src/elixir.erl"},{line,195}]},{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}
Runtime terminating during boot (terminating)

12:52:11.600 [info] Child Tzdata.EtsHolder of Supervisor #PID<0.3047.0> (Supervisor.Default) started
Pid: #PID<0.3048.0>
Start Call: Tzdata.EtsHolder.start_link([])
Crash dump is being written to: erl_crash.dump...done

Facing this issue on

ELIXIR_VERSION=1.17.2
OTP_VERSION=27.0.1
ALPINE_VERSION=3.20.2

My application file

defmodule Butcher.Application do
  @moduledoc false

  use Application

  @impl true
  def start(_type, _args) do
    opts = [strategy: :one_for_one, name: Butcher.Supervisor]

    children = [
      ButcherWeb.Telemetry,
      {Phoenix.PubSub, name: Butcher.PubSub},
      ButcherWeb.Endpoint,
      Butcher.Repo,
    ]

    Supervisor.start_link(children, opts)
  end

  @impl true
  def config_change(changed, _new, removed) do
    ButcherWeb.Endpoint.config_change(changed, removed)
    :ok
  end
end

My Runtime configs

  config :butcher, ButcherWeb.Endpoint,
    server: true,
    url: [host: host, port: https_port, scheme: "https"],
    http: [
      port: port,
      transport_options: [socket_opts: [:inet6]]
    ],
    https: [
      port: https_port,
      cipher_suite: :strong,
      keyfile: key_path,
      certfile: cert_path,
      cacertfile: cacert_path,
      transport_options: [socket_opts: [:inet6]]
    ],
    secret_key_base: secret_key_base

I was able to pinpoint that commenting endpoint in application resulted into starting of application.

Not sure what I’m missing

Marked As Solved

neel-desh

neel-desh

Hey mmmrrr, thanks for taking out time to reply. :pray:

Okay, so the issue was in the docker file that phoenix generated,


WORKDIR "/app"
RUN chown nobody /app

# set runner ENV
ENV MIX_ENV="prod"

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/butcher ./

USER nobody

The app did not had the permission to listen on port 80 and 443 since privilege ports! and it was resulting in the above crash :smiling_face_with_tear:

Removing

RUN chown nobody /app

USER nobody

and Modifying this line worked for us

COPY --from=builder /app/_build/${MIX_ENV}/rel/butcher ./

Also Liked

mmmrrr

mmmrrr

Hey @neel-desh! First of all: great to have you here :slight_smile:

I think your error might be a problem with you erlang installation. There is an older thread where people were complaining about a similar behavior under Mac OS: Fresh install + new project + mix test causes crash (1.14.3) - #12 by kushalj

Is this an issue you only see when running in production? Or do you also see this problem in development?

If the former: have you bundled erlang along with your release, or are you by chance using your system binaries?

mmmrrr

mmmrrr

Hey @neel-desh.
Glad to hear that you were able to pin down the problem yourself!

Just a heads up: you’re potentially opening up a security issue by running the application as root in the container! That’s why this configuration is there in the first place.

Imho the better way would be to not make the app listen on a non priviledged port and then use a reverse proxy (like nginx, or caddy, or traefik, …) to provide the TLS termination, static file routing, or whatever.

While this is not strictly necessary, and sometimes even detrimental if you have a specific setup in mind, I am always suspicious when someone runs software as root :wink:

Good luck with your software!

ryanzidago

ryanzidago

Hey thanks; I managed to solve the issue. In my case it was due to the nobody user not having the required privileges for writing to the Bumblebee / hf caches.

I’ve managed to solve it :ok_hand:

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement