iautom8things

iautom8things

[arm64+otp 25+qemu] `mix local.hex --force` hangs

We haven’t been able to start using Erlang 25, yet, because I’ve been unable to get our base images built with it. Half of our developers use Macs with the new arm processors, so we’ve switched to a process that builds our images with multi arch support.

I’ve created a dumbed down process as an example of how we build it using Github Actions, here:

You can see here where this problem happens with all supported versions (from hexpm/elixir - Docker Image) when using Erlang 25:

https://github.com/iautom8things/test-arm64-qemu-issue/runs/7104382049?check_suite_focus=true

I stopped it after 12.5 minutes.

On an ubuntu machine I have I can also duplicate this hanging:

docker buildx build --platform linux/arm64,linux/amd64 -t test-arm64-qemu-issue --build-arg ELIXIR_VERSION=1.13.4 --build-arg ERLANG_VERSION=25.0 --build-arg ALPINE_VERSION=3.16.0 .

Has anyone had any luck with this?

Most Liked

garazdawi

garazdawi

Erlang Core Team

I don’t know if this is your problem, but because of bugs in qemu when emulating arm64 the JIT does not work there, so you need to run the arm64 docker images on a native arm64 machine, or disable the JIT (which is done when compiling Erlang).

It should manifest as a segfault and not as a hang, but maybe something is masking the segfault.

Edit: You can find some more information here: OTP 25.0-rc3 (release Candidate 3) is released - #25 by jhogberg - Erlang News - Erlang Programming Language Forum - Erlang Forums

mmyers

mmyers

The QEMU bug for the OTP 25 JIT compiler failing was supposedly fixed in qemu 8.1. So maybe the problem we’re seeing with docker cross-builds is a different problem?

I’m running a docker cross-build targeting linux/arm64 from a linux/amd64 host using qemu v8.1.2 and I see a similar problem as the OP, with OTP 24 it builds fine, but with OTP 25 or 26 it will hang forever at a RUN mix deps.get step. Note: For me mix local.rebar and mix local.hex steps complete successfully

Are the only solutions still what @garazdawi recommends? 1) build arm64 images on a native arm64 host, or 2) use an Erlang build with the JIT disabled?

iautom8things

iautom8things

Not quite, we’ve just stuck with 24 for the time being.

Nicoo

Nicoo

I had this problem on my m1. I have a solution that is not ideal but it works, if it can help someone:

  • I have activated Rosetta
  • I have added export DOCKER_DEFAULT_PLATFORM=linux/amd64 in my .zshrc file (.env file should works also).
  • For the rare images where the image doesn’t work well in emulated amd64, I use the arm64 platform. In order not to bother my colleagues by placing my arm64 in the Dockerfile, there is the Docker variable $BUILDPLATFORM

Example:

FROM --platform=$BUILDPLATFORM hexpm/elixir:1.14.3-erlang-25.2.2-ubuntu-jammy-20221130

This is the only image where I need to do that. So all my other images (Postgres, Redis, etc) stay in amd64.
I hope this trick will not be required for too long.

georgeguimaraes

georgeguimaraes

I was having trouble building a amd64 docker image on my MacBook Pro (arm64).

I was about to give up until I tried https://orbstack.dev/ instead of Docker Desktop.

Now it’s working. Maybe orb is using a newer qemu.

Where Next?

Popular in Questions Top

lastday4you
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
fireproofsocks
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
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
fireproofsocks
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
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
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 30048 115
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
vertexbuffer
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
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

We're in Beta

About us Mission Statement