Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing _build/deps with main project causes significant system slowdowns when running alongside Phoenix with auto reload #197

Closed
2 tasks done
cblage opened this issue Apr 11, 2020 · 5 comments

Comments

@cblage
Copy link

cblage commented Apr 11, 2020

Environment

  • Elixir & Erlang versions (elixir --version):
Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.9.4 (compiled with Erlang/OTP 22)
  • Operating system: macOS Catalina 10.15.4
  • Editor or IDE name (e.g. Emacs/VSCode): VSCode Version: 1.44.0
  • LSP Client name: ElixirLS Fork: Elixir support and debugger v0.3.1

Troubleshooting

  • Restart your editor (which will restart ElixirLS) sometimes fixes issues
  • Stop your editor, remove the entire .elixir_ls directory, then restart your editor
    • NOTE: This will cause you to have to re-run the entire dialyzer build

Since elixir_ls shares _build/deps with the main project for a bunch of things, whenever it decides to recompile the code (if running alongside Phoenix with autoreload) - it causes a race condition between the compiler inside Phoenix auto reload and the elixir_ls compiler. This causes significant slowdowns and sometimes warnings and errors while waiting for both to finish.

We should be able to configure it to NEVER re-use the deps or _build directory with the main project to avoid conflicts like these

@axelson
Copy link
Member

axelson commented Apr 11, 2020

Since elixir_ls shares _build/deps with the main project for a bunch of things, whenever it decides to recompile the code (if running alongside Phoenix with autoreload) - it causes a race condition between the compiler inside Phoenix auto reload and the elixir_ls compiler. This causes significant slowdowns and sometimes warnings and errors while waiting for both to finish.

Hmm, the _build is definitely not shared. For ElixirLS it is in your repository_root/.elixir_ls/_build directory (whereas your main build dir is repository_root/_build). While the deps are shared, I wouldn't expect that to cause a slowdown or problems since they are basically read-only except for the case where you've edited your mix.exs to add or update a dependency and ElixirLS starts to download the deps, potentially at the same time as you are downloading the deps yourself, but that doesn't sound like the issue that you are running into.

But with that said I want to better understand the issue that you're running into. What kind of warnings and errors are you seeing? Can you reproduce it on a fresh mix phx.new project? Specific reproduction steps or a sample project would be extremely helpful.

@cblage
Copy link
Author

cblage commented Apr 12, 2020

Sorry, it seems like the _build sharing is no longer happening (I was using the old non-forked version).

However, the deps sharing is still very much happening as you described. It's way less disrupting than sharing _build as the old version did, but it can still be annoying when you trigger a deps fetch / compile in the terminal and ElixirLS interferes. It should probably keep a separate deps inside .elixir_ls like you did for _build.

Thanks!

@axelson
Copy link
Member

axelson commented Apr 12, 2020

@cblage FYI, I opened an issue for a broader discussion on deps handling #201

@cblage
Copy link
Author

cblage commented Apr 12, 2020

@axelson thanks! Should I close this ticket?

@axelson
Copy link
Member

axelson commented Apr 13, 2020

Yeah I think we can close this.

@axelson axelson closed this as completed Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants