elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 196 forks source link

ElixirLS breaks after ash dep update #1108

Closed ken-kost closed 4 months ago

ken-kost commented 4 months ago

Environment

Current behavior

After I updated ash dep from 3.0 to 3.1 I got error in mix:

an exception was raised:
    ** (Mix.Error) Can't continue due to errors on dependencies
        (mix 1.17.1) lib/mix.ex:588: Mix.raise/2
        (mix 1.17.1) lib/mix/tasks/deps.loadpaths.ex:48: Mix.Tasks.Deps.Loadpaths.run/1
        (mix 1.17.1) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
        (mix 1.17.1) lib/mix/tasks/loadpaths.ex:37: Mix.Tasks.Loadpaths.run/1
        (mix 1.17.1) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
        (mix 1.17.1) lib/mix/tasks/compile.ex:153: Mix.Tasks.Compile.run/1
        (mix 1.17.1) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
        (language_server 0.22.0) lib/language_server/build.ex:442: ElixirLS.LanguageServer.Build.run_mix_compile/1
        (language_server 0.22.0) lib/language_server/build.ex:80: anonymous fn/3 in ElixirLS.LanguageServer.Build.build/3
        (stdlib 6.0) timer.erl:590: :timer.tc/2
        (language_server 0.22.0) lib/language_server/build.ex:20: anonymous fn/3 in ElixirLS.LanguageServer.Build.build/3
        (kernel 10.0) global.erl:699: :global.trans/4Elixir
lukaszsamson commented 4 months ago

Is it the right place to report? Probably ash support channels are better in this case. Do you have a small repo that reproduces it?

ken-kost commented 4 months ago

I don't but it should be easy to reproduce. Okay, I'll close the issue then, thanks for the feeback.

zachdaniel commented 4 months ago

To be clear, I'm pretty positive this has nothing to do with Ash at all. Deleting the .elixir_ls directory tends to fix this kind of issue, and it can happen on any dependency change.

ken-kost commented 4 months ago

yep, my bad

zachdaniel commented 4 months ago

Oh, no worries I wasn't calling you out, I just think the issue should potentially still remain open, as there is a situation where elixir-ls seems to get into a state where it can't operate after dependencies change.

lukaszsamson commented 4 months ago

It's notoriously hard to reset mix and app controller state without restarting the os process. AFAIK it affects all elixir language servers to some extent. Do you happen to have a reliable repro? I fixed a few similar issues in the last years

zachdaniel commented 4 months ago

I don't have a reproduction unfortunately 😢 I think it is both transient and timing related. The only things I've noticed so far is that it seems to happen more with bigger dependencies/bigger upgrades, and it doesn't always happen.

lukaszsamson commented 4 months ago

Yep, switching branches in bigger projects with > 20 deps triggers various bugs in mix and hex. Just today I was able to trigger corrupted hex cache from the command line only