ydg33
Mix release crashing due to elixir_ls_utils, despite it not being in `mix deps.tree`
Hello!
I’m using a Dockerfile generated by Fly.io for an Elixir/Phoenix app. Unfortunately it crashes on boot. There’s no information logged to stderr, but the following is visible in erl_crash.dump:
Slogan: Runtime terminating during boot ({badarg,[{io,put_chars,[standard_error,[<<42,42,32,40,69,88,73,84,32,102,114,111,109,32,35,80,73,68,60,48,46,57,56,46,48,62,41,32,97,110,32,101,120,99,101,112,116,105,111,110,32,119,97,115,32,114,97,105,115,101,100,58,10,32,32,32,32,42,42,32,40,69,114,108,97,110,103,69,114,114,111,114,41,32,69,114,108,97,110,103,32,101,114,114,111,114,58,32,58,116,101,114,109,105,110,97,116,101,100,10,32,32,32,32,32,32,32,32,40,101,108,105,120,105,114,32,49,46,49,54,46,48,41,32,108,105,98,47,105,111,46,101,120,58,50,55,52,58,32,73,79,46,98,105,110,119,114,105,116,101,47,50,10,32,32,32,32,32,32,32,32,40,101,108,105,120,105,114,95,108,115,95,117,116,105,108,115,32,48,46,50,48,46,48,41,32,108,105,98,47,111,117,116,112,117,116,95,100,101,118,105,99,101,46,101,120,58,51,55,58,32,69,108,105,120,105,114,76,83,46,85,116,105,108,115,46,79,117,116,112,117,116,68,101,118,105,99,101,46,108,111,111,112,47,49,10,32,32,32,32,32,32,32,32,40,101,108,105,120,105,114,32,49,46,49,54,46,48,41,32,108,105,98,47,116
I’m not sure what’s going on there, but plugging the binary into iex I see:
** (EXIT from #PID<0.98.0>) an exception was raised:
** (ErlangError) Erlang error: :terminated
(elixir 1.16.0) lib/io.ex:274: IO.binwrite/2
(elixir_ls_utils 0.20.0) lib/output_device.ex:37: ElixirLS.Utils.OutputDevice.loop/1
(elixir 1.16.0) lib/t"
Now I’m quite confused because
- My Dockerfile is using hexpm/elixir:1.16.3-erlang-26.2.5-debian-bullseye-20240513-slim, so where is elixir 1.16.0 coming from?
- Where is elixir_ls_utils 0.20.0 coming from? It’s not a direct dependency in
mix.exs, a transitive dependency inmix deps.tree, or mentioned in theDockerfile.
Here’s the Dockerfile that fly launch generated:
ARG ELIXIR_VERSION=1.16.3
ARG OTP_VERSION=26.2.5
ARG DEBIAN_VERSION=bullseye-20240513-slim
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} as builder
# install build dependencies
RUN apt-get update -y \
&& apt-get install -y build-essential git libexpat1-dev \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV="prod"
# install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config
# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY priv priv
COPY lib lib
COPY assets assets
# compile assets
RUN mix assets.deploy
# Compile the release
RUN mix compile
# Changes to config/runtime.exs don't require recompiling the code
COPY config/runtime.exs config/
COPY rel rel
RUN mix release
# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}
RUN apt-get update -y && \
apt-get install -y libstdc++6 openssl libexpat1 libncurses5 locales ca-certificates \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
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/foo ./
USER nobody
CMD ["/app/bin/server"]
Does anyone know what I could do to debug this?
Most Liked
ydg33
I still have no idea why elixir 1.16.0 and elixir_ls are in the stacktrace, but after modifying the Dockerfile to use Debian 12 (bookworm) instead of Debian 11 (bullseye), I now hit a different error! Very mysterious.
1
Popular in Questions
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
can someone please explain to me how Enum.reduce works with maps
New
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
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Other popular topics
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
What is most correct way to open, read and parse JSON file with poison?
For example if we have example.json file in root of some projec...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New







