Elixir: Elixir (1.5.1) recompiles the deps code everytime after I edited my code

Created on 3 Aug 2017  Â·  13Comments  Â·  Source: elixir-lang/elixir

Environment

  • Elixir & Erlang versions (elixir 1.5.1), opt 20
  • win7 64

Current behavior

step:

  1. "iex -S mix debug_client"
  2. change some code of server.ex
  3. try "iex -S mix debug_client" again,
    then you can sell the console recompile the chronos app, logger_file_backend app, decimal app

Here is the bug test repository: https://github.com/neroishero/elixir_test

Mix Bug Needs more info Windows

Most helpful comment

Sure, if we can validate the assumption that the slowdown is not significant, then we can consider completely moving away from mtimes. But until then, someone needs to provide the hash-based implementation and perform the relevant benchmarks.

All 13 comments

I could not reproduce it locally. @overminddl1 @OnorioCatenacci could one of you please give it a try on Windows? thank you!

I'll see if I can get to it. I don't have Win 7; have Win 10 but I'll see if I can repro it on that platform.

I checked this on Windows 10. Cannot reproduce the behavior. Couple of thoughts for @neroishero:

How do you exit iex (step 1)? I do a System.halt() in iex to insure everything is shut down.

What sort of change do you make in server.ex? Can you specifically tell us what kind of change you make? I just added a comment which did trigger recompilation but not of every file.

Are you sure that everything compiled correctly for step 1? If something didn't get compiled in step 1 that would cause the behavior you're seeing.

As I say, I know this is Win 10 not Win 7 and that may make a difference so we need someone with Win 7 to try to reproduce this but it'd also help if you could provide those details I spelled out.

Just to double check, I also tried modifying server.ex without shutting down iex. I then did a recompile inside iex. Same behavior--it only recompiled the proper files.

I checked this on Windows 10. Cannot reproduce the behavior. Couple of thoughts for @neroishero:

Similar here, which again makes me think it is something system specific like a file syncher or antivirus or so.

Would it be possible to add a compiler option to mix that would make it hash every file instead of checking the utime + file size?

I could not reproduce it under Windows 7 Pro 64bit.
Between the two iex sessions I edited this line: https://github.com/neroishero/elixir_test/blob/master/lib/service/server.ex#L75 (I increased the time).
I ended the first iex session with CTRL+C.
Session log is here.

@robi-wan its likely neroishero has an antivirus, malware or some filesystem that messes with the files utimes. Hence why reproducing it outside their environment is unlikely.

Since multiple users have reported they could not reproduce the issue, I will go ahead and close this issue. Thank you for reporting and please follow up on the suggestions mentioned here. Thanks everyone who investigated and followed up. :+1:

Using utimes is clearly problematic for deciding whether to recompile deps, its funny how no one wants to admit this.

At the same time mtimes+size is by far the fastest approach to this. I believe someone was working on file hashing and we are definitely open to such contributions. But even if added hashing to Mix, I don't think it would replace mtimes+size as the default choice for projects.

It might be the fastest but whats faster 1ms ping or 3ms ping, at this level of speed it really does not matter. The only problem I can see is if your project has thousands of source files (most users would have under 100), even then on an SSD it should be quite speedy. HDD's might/would suffer.

Sure, if we can validate the assumption that the slowdown is not significant, then we can consider completely moving away from mtimes. But until then, someone needs to provide the hash-based implementation and perform the relevant benchmarks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericmj picture ericmj  Â·  3Comments

alexrp picture alexrp  Â·  4Comments

LucianaMarques picture LucianaMarques  Â·  3Comments

andrewcottage picture andrewcottage  Â·  3Comments

Paddy3118 picture Paddy3118  Â·  3Comments