3

I'm running a container with an Elixir application, but when I try to make a bootstrap I get the following error:

12:49:59.687 [error] beam/beam_load.c(1863): Error loading module pooler_app: This BEAM file was compiled for a later version of the run-time system than 20. To fix this, please recompile this module with an 20 compiler. (Use of opcode 164; this emulator supports only up to 159.)

12:49:59.707 [info] Application pooler exited: exited in: :pooler_app.start(:normal, []) ** (EXIT) an exception was raised: ** (UndefinedFunctionError) function :pooler_app.start/2 is undefined (module :pooler_app is not available) (pooler) :pooler_app.start(:normal, []) (kernel) application_master.erl:273: :application_master.start_it_old/4 ** (ArgumentError) argument error (stdlib) :ets.lookup(:cqerl_clusters, :system) (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_cluster.erl:52: :cqerl_cluster.get_any_client/1 lib/cassandra.ex:50: Lukla.Cassandra.new_client/1 lib/cassandra.ex:11: Lukla.Cassandra.new!/1 lib/mix/tasks/cassandra.drop.ex:16: Mix.Tasks.Cassandra.Drop.run/1 (mix) lib/mix/task.ex:314: Mix.Task.run_task/3 (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2 (elixir) lib/enum.ex:737: Enum.each/2

I tried to change the Elixir version and Erlang version, but the error persists.

I'm using asdf with Elixir 1.6.5 and Erlang 20.0.

Edit

I deleted my _build folder, now when I try the bootstrap again I get the following error:

14:17:44.539 [error] Loading of /mnt/svcs/lukla/_build/dev/lib/re2/ebin/re2.beam failed: :badfile

14:17:44.539 [error] beam/beam_load.c(1863): Error loading module re2: This BEAM file was compiled for a later version of the run-time system than 20. To fix this, please recompile this module with an 20 compiler. (Use of opcode 164; this emulator supports only up to 159.)

** (exit) exited in: :gen_fsm.sync_send_event(#PID<0.360.0>, {:send_query, #Reference<0.2121126444.1751646212.63871>, {:cql_query, "DROP KEYSPACE IF EXISTS lukla_dev;", [], :undefined, false, 100, :undefined, :one, :undefined, :undefined}}, 5000) ** (EXIT) an exception was raised: ** (UndefinedFunctionError) function :re2.compile/1 is undefined (module :re2 is not available) (re2) :re2.compile('\'(\?|:\w+)\'(?:(?:[^"]"[^"]")[^"]$)') (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_cache.erl:58: :cqerl_cache.lookup/2 (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_client.erl:244: :cqerl_client.live/3 (stdlib) gen_fsm.erl:483: :gen_fsm.handle_msg/8 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 (stdlib) gen_fsm.erl:252: :gen_fsm.sync_send_event/3 (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl.erl:196: :cqerl.run_query/3 lib/cqex/query.ex:62: CQEx.Query.call/2 lib/cqex/query.ex:75: CQEx.Query.call!/2 lib/mix/tasks/cassandra.drop.ex:18: Mix.Tasks.Cassandra.Drop.run/1 (mix) lib/mix/task.ex:314: Mix.Task.run_task/3 (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2 (elixir) lib/enum.ex:737: Enum.each/2

14:17:44.572 [error] ** State machine #PID<0.360.0> terminating ** Last message in was {:"$gen_sync_event", {#PID<0.74.0>, #Reference<0.2121126444.1751646212.63875>}, {:send_query, #Reference<0.2121126444.1751646212.63871>, {:cql_query, "DROP KEYSPACE IF EXISTS lukla_dev;", [], :undefined, false, 100, :undefined, :one, :undefined, :undefined}}} ** When State == :live ** Data == {:client_state, :cqerl_auth_plain_handler, :undefined, :undefined, {'cassandra', 9042}, :tcp, #Port<0.8647>, :undefined, :system, :infinity, "", :undefined, [{0, :undefined}, {1, :undefined}, {2, :undefined}, {3, :undefined}, {4, :undefined}, {5, :undefined}, {6, :undefined}, {7, :undefined}, {8, :undefined}, {9, :undefined}, {10, :undefined}, {11, :undefined}, {12, :undefined}, {13, :undefined}, {14, :undefined}, {15, :undefined}, {16, :undefined}, {17, :undefined}, {18, :undefined}, {19, :undefined}, {20, :undefined}, {21, :undefined}, {22, :undefined}, {23, :undefined}, {24, :undefined}, {25, :undefined}, {26, :undefined}, {27, :undefined}, {28, :undefined}, {29, :undefined}, {30, :undefined}, {31, :undefined}, {32, :undefined}, {33, :undefined}, {34, :undefined}, {35, ...}, {...}, ...], {[], []}, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...], [], :hash, {{'cassandra', 9042}, [included_applications: [], keyspace: :system, num_clients: 2, query_timeout: 5000]}} ** Reason for termination = ** {:"module could not be loaded", [{:re2, :compile, ['\'(\?|:\w+)\'(?:(?:[^"]"[^"]")[^"]$)'], []}, {:cqerl_cache, :lookup, 2, [file: '/mnt/svcs/lukla/deps/cqerl/src/cqerl_cache.erl', line: 58]}, {:cqerl_client, :live, 3, [file: '/mnt/svcs/lukla/deps/cqerl/src/cqerl_client.erl', line: 244]}, {:gen_fsm, :handle_msg, 8, [file: 'gen_fsm.erl', line: 483]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}

My .dockerignore is:

_build
.git
node_modules
deps
priv/static

My Dockerfile:

FROM xerpa/ubuntu:v20190114

# Compile in prod mode by default
ARG MIX_ENV=prod

# .mix folder will be inside the project
ARG LUKLA_HOME=/var/www/lukla

ENV MIX_ENV=${MIX_ENV}
ENV LUKLA_HOME=${LUKLA_HOME}
ENV MIX_HOME=${LUKLA_HOME}/.mix

WORKDIR $LUKLA_HOME

RUN wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc -O /erlang-solutions.asc \
    && echo deb https://packages.erlang-solutions.com/ubuntu artful contrib | tee /etc/apt/sources.list.d/erlang-solutions.list \
    && apt-key add /erlang-solutions.asc

RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install -y \
    esl-erlang=1:20.3 \
    libboost-dev \
    libboost-system-dev \
    libboost-thread-dev \
    libgraphicsmagick-dev \
    libgtest-dev \
    libicu-dev \
    libphonenumber-dev \
    libgeocoding7 \
    libprotobuf-dev \
    libre2-dev \
    libtool-bin \
    libwebp-dev \
    build-essential \
    cmake \
    cmake-curses-gui \
    lsb-release \
    protobuf-compiler \
    openjdk-8-jre \
    locales \
    poppler-utils \
    elixir=1.6.5-1 \
    tzdata \
    && ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime \
    && dpkg-reconfigure --frontend noninteractive tzdata \
    && rm -rf /var/lib/apt/lists/*

RUN echo en_US.UTF-8 UTF-8 | tee /etc/locale.gen
RUN echo locales locales/default_environment_locale select en_US.UTF-8 | debconf-set-selections
RUN echo locales locales/locales_to_be_generated multiselect en_US ISO-8859-1, en_US.UTF-8 UTF-8 | debconf-set-selections
RUN locale-gen

# Stuff that should be cached
COPY ./.credo.exs ./.credo.exs
COPY ./.formatter.exs ./.formatter.exs
COPY ./apps/lukla_web/mix.exs ./apps/lukla_web/mix.exs
COPY ./apps/magoo/mix.exs ./apps/magoo/mix.exs
COPY ./apps/yak/mix.exs ./apps/yak/mix.exs
COPY ./mix.exs ./mix.exs
COPY ./mix.lock ./mix.lock
COPY ./config ./config
COPY ./automation ./automation

RUN test -f ${MIX_HOME}/archives/hex*.ez || mix local.hex --force
RUN test -f ${MIX_HOME}/rebar || mix local.rebar --force

RUN mix hex.organization auth xerpa --key xxxxxxxxxxxxxxxxxxxxxxx
RUN mix deps.get
RUN mix deps.compile

COPY ./apps ./apps
COPY ./boot ./boot
COPY ./doc ./doc
COPY ./package ./package

RUN mix compile
RUN mix phoenix.digest apps/lukla_web/web/static/assets -o apps/lukla_web/priv/static

15
  • Try deleting all *.beam files for your applications and dependencies (including in the _build directory), and recompiling. Commented Jun 5, 2019 at 13:04
  • Can you share your Dockerfile and your docker ignore file? I suspect you are copying the _build folder to the container and the version used on that are different of the host machine. Try not copy that folder and compile it inside the container. Commented Jun 5, 2019 at 13:05
  • 1
    @legoscia I tried remove the _build, but now I get other errors, I edited my question with these ones. Commented Jun 5, 2019 at 14:19
  • 1
    @FelipeAugusto based on the dockerfile I don't see any reason why you can't use the official image. Also, doing that you will have more control on versions update since you can't trust that the apt source will always have the version that you need/want. Commented Jun 5, 2019 at 15:54
  • 1
    @FelipeAugusto yes, it will compile dependencies only. If you take a look, the latest message that you shared is complaining about a dependency. So, it might be replacing the compiled version with that copy. Commented Jun 5, 2019 at 15:56

1 Answer 1

3

The first error message indicates an outdated build, then to solve that I needed to:

rm -rf project/_build

And tried again the bootstrap, however it showed the second error, about the re2 lib compiled with a different version, even deleting the _build and images didn't solve the issue, then I thought about compile the project (and libs, then try the bootstrap after):

mix compile

As mentioned by @Marcos Tapajós, I believe mix clean would work too.

Then my command worked:

./project bootstrap

I guess there are other place where the package was outdated on my machine.

Sign up to request clarification or add additional context in comments.

1 Comment

Try mix deps.clean and mix clean before the mix compile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.