opsidao

opsidao

Weird limit in number of function clauses when running on aarch64

I have some code that generates a few thousand function clauses via a macro that runs fine in most platforms but when trying to run it in Docker on an ARM mac it fails in a weird way.

Here’s a contrived example that reproduces the issue:

defmodule Test do
  Enum.each 1..4096, fn id ->
    def __id__(unquote(id)) do
      IO.puts("Executing clause for #{unquote(id)}")
    end
  end
end


Test.__id__(2)

If running on native Linux or Mac, this code runs fine regardless of the number of clauses generated but when running in an “aarch64 Linux” docker image, then the code compiles fine in every case but the call to Test.__id__(2) fails with a no function clause matching error when the number of clauses is bigger than 4096.

This is happening with Erlang/OTP 25 [erts-13.2] and Elixir 1.14.2.

It there something that I’m missing here or should I open a bug in the github repo?

Thanks!

Most Liked

jhogberg

jhogberg

Erlang Core Team

No need, I’ll open a PR with the fix shortly and prepare it for release in the next patch. In the future you can report similar issues at Issues · erlang/otp · GitHub if you wish. :slight_smile:

Thanks for reporting it! :slight_smile:

jhogberg

jhogberg

Erlang Core Team

I think I see why, can you apply this commit and see if it fixes the problem?

opsidao

opsidao

Well @jhogberg, it seems like that is precisely the problem in this case!

I borrowed the erlang and elixir Dockerfiles and combined them into a single one to test this in GitHub - opsidao/erlang_clause_limit_but_on_arm: Small reproduction of erlang bug · GitHub. I added a small, dirty, one liner to apply the patch using sed and the error stops happening.

What would be the next step here? Should I report it somewhere?

Where Next?

Popular in Questions Top

New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
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
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
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
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
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
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
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement