Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

ismaelga
Copy link
Contributor

Was seeing this errors from NextLS. They where caused by starting new compilation before last one completed. Keeping compiler refs seems to do the trick.
I was wondering if a better approach would be to kill the old one as it's probably not relevant anymore

14:24:17.546 [error] GenServer #PID<0.271.0> terminating
** (FunctionClauseError) no function clause matching in NextLS.Runtime.handle_info/2
    (next_ls 0.12.6) lib/next_ls/runtime.ex:241: NextLS.Runtime.handle_info({#Reference<0.0.34691.4055572929.3734306818.94126>, [%Mix.Task.Compiler.Diagnostic{file: "...", severity: :error, message: "...", position: 6, compiler_name: "Elixir", details: nil, stacktrace: [{UsedSailboat.Repo, :__MODULE__, 0, [file: "...", line: 6]}]}, %Mix.Task.Compiler.Diagnostic{file: "...", severity: :error, message: "...", position: 0, compiler_name: "Elixir", details: nil, stacktrace: [{:elixir_expand, :expand, 3, [file: ~c"src/elixir_expand.erl", line: 92]}, {:elixir_expand, :expand_block, 5, [file: ~c"src/elixir_expand.erl", line: 538]}, {:elixir_expand, :expand, 3, [file: ~c"src/elixir_expand.erl", line: 46]}, {Kernel, :use, 2, [file: ~c"expanding macro"]}, {UsedSailboat.Repo, :__MODULE__, 0, [file: ~c"lib/used_sailboat/repo.ex", line: 6]}]}]}, %{logger: #PID<0.259.0>, name: "...", node: :"...", parent: ~c"", port: #Port<0.10>, registry: NextLS.Registry, errors: nil, task_supervisor: :runtime_task_supervisor, on_initialized: #Function<33.24109284/1 in NextLS.handle_notification/2>, working_dir: "...", compiler_ref: %{#Reference<0.0.34691.4055572929.3734306817.102674> => {#PID<0.286.0>, #Reference<0.4055572929.3734241281.102671>}, #Reference<0.0.34691.4055572929.3734306817.110339> => {#PID<0.288.0>, #Reference<0.4055572929.3734241281.110336>}}})
    (stdlib 5.0.2) gen_server.erl:1077: :gen_server.try_handle_info/3
    (stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
    (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

@mhanberg
Copy link
Collaborator

I was wondering if a better approach would be to kill the old one as it's probably not relevant anymore

Yes, cancelling them should be done. You can see an example of that in next_ls.ex

Thanks for this patch!

Cancels previous compile requests when a new one comes in.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants