Elixir recompiling all files each time

I’m working on a fairly large app and when running the tests it recompiles all files each time. This is pretty annoying, obviously, as it takes quite some time.

I have tracked it down and the issue seems that the “compile manifest” that is written after compilation (in the Mix.Compilers.Elixir module) cannot be read back in (throwing a badarg on this line ), so mix considers all files “new” and compiles everything.

When I remove the compressed: 9 option to :term_to_binary, all goes well. @michalmuskala suggested I post this here because more people might have the same issue. It could have something to do with a bug in Erlang’s zlib. I am already on the latest Erlang (19.2), running on Arch Linux.

Using different Erlang versions does not seem to differ; I have built several Erlang versions using kerl and keep getting the same error.

I think it might help us if you were able to include your manifest file here or gist it. Could you please do that?

Sure, I’ll see if I can produce a manifest that exhibits the same behaviour that doesn’t contain trade secrets :wink:

Edit: no longer needed, as its a known Erlang bug

@arjan you are hitting the issue that :erlang.binary_to_term has a bug when uncompressing some data depending on the zlib version. Here is the discussion about it in the Erlang mailing list: [erlang-questions] Problem with binary_to_term on different machines

You can either change zlib OR check if latest Erlang has solved it.

Thanks for the link, latest Erlang does not fix it, I’ll try applying the patch he mentions.

Would you consider it a bug that mix swallows the error? (as seen here)? Took me quite a while to figure out :slight_smile:

What a concidence, yesterday they released 19.3, which contains a fix for this. (issue OTP-14159). Case closed!