Error on incremental compilation in MIX_ENV=test with Elixir 1.19

Hi!

I am trying to pinpoint why my project has issue on incremental compilation when running tests in elixir 1.19.0-rc.0-otp-26

I am running an umbrella project. When I change a file, it triggers recompilation in a couple of apps across umbrella.

I am getting errors like this:

mix deps.compile running across 4 OS processes
4> ==> app1
4> Compiling 1 file (.ex)
4> Generated app1 app
1> ==> app2
1> Compiling 1 file (.ex)
1> Generated app2 app
3> ==> app3
3> Compiling 1 file (.ex)
1> ==> app4
1> Compiling 8 files (.ex)
3> Generated app3 app
1> Generated app4 app
1> ==> app5
1> Compiling 102 files (.ex)
1> Generated app5 app
1> ==> app6
1> Compiling 6 files (.ex)
1> Generated app6 app
** (EXIT from #PID<0.98.0>) an exception was raised:
    ** (File.Error) could not write to file "/Users/user1/project/_build/test/consolidated/Elixir.Plug.Exception.beam": no such file or directory
        (elixir 1.19.0-rc.0) lib/file.ex:1401: File.write!/3
        (mix 1.19.0-rc.0) lib/mix/compilers/protocol.ex:159: Mix.Compilers.Protocol.consolidate_each/4
        (elixir 1.19.0-rc.0) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
        (elixir 1.19.0-rc.0) lib/task/supervised.ex:40: Task.Supervised.reply/4


20:05:54.679 [error] Task #PID<0.902.0> started from #PID<0.98.0> terminating
** (File.Error) could not write to file "/Users/tomaszkowal/bluecodecom/scheme-services-19/_build/test/consolidated/Elixir.Plug.Exception.beam": no such file or directory
    (elixir 1.19.0-rc.0) lib/file.ex:1401: File.write!/3
    (mix 1.19.0-rc.0) lib/mix/compilers/protocol.ex:159: Mix.Compilers.Protocol.consolidate_each/4
    (elixir 1.19.0-rc.0) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
    (elixir 1.19.0-rc.0) lib/task/supervised.ex:40: Task.Supervised.reply/4
Function: #Function<8.102399383/0 in Mix.Compilers.Protocol.consolidate/4>
    Args: []

  ...

and then a long list of similarly looking errors for all protocols: Collectable, Phoenix.HTML.Safe and so on and so forth.

This never happened on Elixir 1.18.x or any other previous versions.

I am somewhat sure it is connected to the parallel compilation. Other facts:

  • I doesn’t happen always
  • it only happens on incremental compilation
  • it seems to be pure chance if introducing a new line triggers it or compiles fine
  • it only runs in MIX_ENV=test
  • when it compiles, subsequent invocation of mix test work fine

I wasn’t able to reproduce it outside of our production app, so I don’t have a minimal reproduction example yet that I could share.

Did anybody see anything like that?