Skip to content

v1.19.0-rc.1 - compilation does not finish with for comprehension in Ecto.Migrator anomymous functionΒ #14810

@kevinschweikert

Description

@kevinschweikert

Elixir and Erlang/OTP versions

Erlang/OTP 28 [erts-16.1] [source] [64-bit] [smp:11:11] [ds:11:11:10] [async-threads:1] [jit]

Elixir 1.19.0-rc.1 (f642b30) (compiled with Erlang/OTP 28)

Erlang 28.1

Operating system

macOS

Current behavior

After trying to compile our production app, the compilation never (i canceled it after ten minutes) on an Apple M3 processor.

> time mix compile
....
Compiling 142 files (.ex)
Verifying MyApp.Seeds (it's taking more than 10s)
^C
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
^C
________________________________________________________
Executed in  716.14 secs    fish           external
   usr time  708.74 secs    0.34 millis  708.74 secs
   sys time    4.90 secs    1.71 millis    4.90 secs

In our production app we have a seed.ex file. When i remove it the compilation finishes almost instantly.

I could reduce the issue down to a for comprehension in the Ecto.Migrator anomymous function

defmodule MyApp.Seeds do
  def seed() do
    Ecto.Migrator.with_repo(MyApp.Repo, fn repo ->
      for i <- 1..100//1 do
        %MyApp.SomeSchema{
          some_field: "foo",
          some_assocs: [
            %MyApp.SomeOtherSchema{
              field_1: "bar",
            }
          ]
        }
        |> repo.insert!()
      end
    end)
  end
end

Expected behavior

Reasonable compilation times. Let me know if i should add more information!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions