I’ve hit an error compiling a Phoenix app that I’ve never seen before.
** (exit) an exception was raised:
** (SystemLimitError) a system limit has been reached
(stdlib) :ets.new(:edges, [:set, :protected])
(stdlib) digraph.erl:78: :digraph.new/1
(elixir) lib/module/locals_tracker.ex:232: Module.LocalsTracker.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
And
[error] ** Too many db tables **
Using
Elixir 1.5.1
Phoenix 1.3.0
It happens at different files each compile, so it’s not consistently happening at one point in the app or another.
I can only tell you that the error message means the system is running out of ets tables. The default limit is 1400 but it can be changed by a flag to the erlang runtime.
For example: iex --erl '+e 10000'
That said, don’t blindly just increase this level. It is usually a sign that something is not quite right and that you must actually understand the problem
You see this once in a while in running systems but the question is why it is happening during compilation. Is the error always in the locals_tracker module? It may be cause of it but you may also run out of ets tables else where and the locals_tracker only happen to be the one reaching the limit.
In a running system I would set-up traces to see when :ets.new is being called and monitor it to find out who is the offender but I don’t know how to do this during compilation
Thanks, yeah it’s an odd one…
Only other information I can add is that we have about 600 modules in this app. I don’t know if there are any limits there?
Well, from a quick look at locals_tracker it is responsible for “tracking calls in order to extract Elixir modules’ behaviour during compilation time”.
So it is certainly possible that the number of modules in an application could have something to do with it Unfortunately it is beyond my knowledge how the elixir compilation works.
During compilation there are a lot of ets-tables created, and as far as I can remember, one for each module to hold the modules metadata such that it can be accessed from other compilers easily (one writer, many readers).