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. 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

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
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
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
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
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

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
sergio
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
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
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 record...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement