vscode-elixir-ls icon indicating copy to clipboard operation
vscode-elixir-ls copied to clipboard

Memory and High CPU Usage

Open yordis opened this issue 1 year ago • 4 comments

I was working on the Tesla package and went to sleep. When I resumed work, I noticed that my computer was almost unresponsive. The extension had consumed all available RAM and spiked the CPU.

This is not the first time it has happened; just that this time, I didn't close it or click on the extension's notification complaining about compilation errors or something else.

Environment

  • Elixir & Erlang versions: Elixir 1.16.2, Erlang/OTP 26
  • VSCode ElixirLS version: v0.20.0
  • Operating System Version: macOS 14.2.1

Troubleshooting

  • [x] Restart your editor (which will restart ElixirLS) sometimes, fixes issues
  • [x] Stop your editor, remove the entire .elixir_ls directory, then restart your editor

Crash report template

Screenshot 2024-04-18 at 10 48 28 AM Screenshot 2024-04-18 at 10 48 37 AM

View Logs ``` [Info - 12:20:25 AM] Compile took 6920 milliseconds [Info - 12:20:25 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:20:25 AM] Starting build with MIX_ENV: test MIX_TARGET: host [Info - 12:20:25 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:20:25 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 25ms [Info - 12:20:32 AM] Compile took 6413 milliseconds [Info - 12:20:32 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:20:32 AM] [ElixirLS Dialyzer] Found 1 changed files in 76 milliseconds [Info - 12:20:32 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:20:33 AM] [ElixirLS Dialyzer] Analysis finished in 449 milliseconds [Info - 12:20:33 AM] Dialyzer analysis is up to date [Info - 12:20:33 AM] Success typings computed in 88ms [Info - 12:20:34 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:20:34 AM] Success typings computed in 46ms [Info - 12:20:35 AM] [ElixirLS Dialyzer] Done writing manifest in 1863 milliseconds. [Info - 12:20:41 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:20:46 AM] Compile took 5173 milliseconds [Info - 12:20:46 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:20:46 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:20:46 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms [Info - 12:20:46 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:20:46 AM] [ElixirLS Dialyzer] Found 1 changed files in 69 milliseconds [Info - 12:20:46 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:20:47 AM] [ElixirLS Dialyzer] Analysis finished in 373 milliseconds [Info - 12:20:47 AM] Dialyzer analysis is up to date [Info - 12:20:47 AM] Success typings computed in 76ms [Info - 12:20:47 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:20:48 AM] [ElixirLS Dialyzer] Done writing manifest in 1558 milliseconds. [Info - 12:20:52 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:21:01 AM] Compile took 8649 milliseconds [Info - 12:21:01 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:21:01 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:21:01 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms [Info - 12:21:01 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:21:01 AM] [ElixirLS Dialyzer] Found 1 changed files in 197 milliseconds [Info - 12:21:01 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:21:02 AM] [ElixirLS Dialyzer] Analysis finished in 429 milliseconds [Info - 12:21:02 AM] Dialyzer analysis is up to date [Info - 12:21:02 AM] Success typings computed in 92ms [Info - 12:21:03 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:21:03 AM] Success typings computed in 62ms [Info - 12:21:04 AM] [ElixirLS Dialyzer] Done writing manifest in 1872 milliseconds. Received $/cancelRequest for unknown request id: 2155 [Info - 12:21:11 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:21:21 AM] Compile took 9616 milliseconds [Info - 12:21:21 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:21:21 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:21:21 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms [Info - 12:21:21 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:21:21 AM] [ElixirLS Dialyzer] Found 1 changed files in 74 milliseconds [Info - 12:21:22 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:21:22 AM] [ElixirLS Dialyzer] Analysis finished in 396 milliseconds [Info - 12:21:22 AM] Dialyzer analysis is up to date [Info - 12:21:22 AM] Success typings computed in 75ms [Info - 12:21:22 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:21:23 AM] [ElixirLS Dialyzer] Done writing manifest in 1416 milliseconds. [Info - 12:21:29 AM] Success typings computed in 136ms [Info - 12:21:41 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:21:48 AM] Compile took 6908 milliseconds [Info - 12:21:48 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:21:48 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:21:48 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms [Info - 12:21:48 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:21:48 AM] [ElixirLS Dialyzer] Found 1 changed files in 143 milliseconds [Info - 12:21:48 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:21:49 AM] [ElixirLS Dialyzer] Analysis finished in 576 milliseconds [Info - 12:21:49 AM] Dialyzer analysis is up to date [Info - 12:21:49 AM] Success typings computed in 81ms [Info - 12:21:50 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:21:50 AM] Success typings computed in 96ms [Info - 12:21:51 AM] [ElixirLS Dialyzer] Done writing manifest in 1615 milliseconds. [Info - 12:22:17 AM] Success typings computed in 59ms [Info - 12:22:23 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:22:30 AM] Compile took 6522 milliseconds [Info - 12:22:30 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:22:30 AM] Starting build with MIX_ENV: test MIX_TARGET: host [Info - 12:22:30 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:22:30 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 2ms [Info - 12:22:36 AM] Compile took 5908 milliseconds [Info - 12:22:36 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:22:36 AM] [ElixirLS Dialyzer] Found 1 changed files in 180 milliseconds [Info - 12:22:36 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:22:37 AM] [ElixirLS Dialyzer] Analysis finished in 386 milliseconds [Info - 12:22:37 AM] Dialyzer analysis is up to date [Info - 12:22:37 AM] Success typings computed in 80ms [Info - 12:22:37 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:22:38 AM] Success typings computed in 111ms [Info - 12:22:38 AM] [ElixirLS Dialyzer] Done writing manifest in 1640 milliseconds. [Info - 12:22:47 AM] Success typings computed in 51ms [Info - 12:23:10 AM] Success typings computed in 195ms [Info - 12:23:16 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:23:23 AM] Compile took 6846 milliseconds [Info - 12:23:23 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:23:23 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:23:23 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:23:23 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms [Info - 12:23:23 AM] [ElixirLS Dialyzer] Found 1 changed files in 71 milliseconds [Info - 12:23:24 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:23:24 AM] [ElixirLS Dialyzer] Analysis finished in 449 milliseconds [Info - 12:23:24 AM] Dialyzer analysis is up to date [Info - 12:23:24 AM] Success typings computed in 97ms [Info - 12:23:25 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 12:23:26 AM] [ElixirLS Dialyzer] Done writing manifest in 1858 milliseconds. [Info - 12:24:25 AM] Success typings computed in 60ms [Info - 12:24:27 AM] Starting build with MIX_ENV: test MIX_TARGET: host Compiling 1 file (.ex) [Info - 12:24:37 AM] Compile took 9439 milliseconds [Info - 12:24:37 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:24:37 AM] Starting build with MIX_ENV: test MIX_TARGET: host [Info - 12:24:37 AM] [ElixirLS WorkspaceSymbols] 1 modules need reindexing [Info - 12:24:37 AM] [ElixirLS WorkspaceSymbols] 2 symbols added to index in 1ms Received $/cancelRequest for unknown request id: 2272 [Info - 12:24:47 AM] Compile took 9905 milliseconds [Info - 12:24:47 AM] [ElixirLS WorkspaceSymbols] Updating index... [Info - 12:24:47 AM] Starting build with MIX_ENV: test MIX_TARGET: host [Info - 12:24:47 AM] [ElixirLS WorkspaceSymbols] 0 modules need reindexing [Info - 12:24:47 AM] [ElixirLS WorkspaceSymbols] 0 symbols added to index in 0ms [Info - 12:24:58 AM] Compile took 11430 milliseconds [Info - 12:24:58 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 12:24:59 AM] [ElixirLS Dialyzer] Found 1 changed files in 120 milliseconds [Info - 12:24:59 AM] [ElixirLS Dialyzer] Analyzing 1 modules: [Tesla.AdapterCase.SSL] [Info - 12:24:59 AM] [ElixirLS Dialyzer] Analysis finished in 433 milliseconds [Info - 12:24:59 AM] Dialyzer analysis is up to date [Info - 12:24:59 AM] Success typings computed in 116ms [Info - 12:25:00 AM] [ElixirLS Dialyzer] Writing manifest... [Warn - 12:25:00 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:01 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:01 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Info - 12:25:01 AM] [ElixirLS Dialyzer] Done writing manifest in 2000 milliseconds. [Warn - 12:25:01 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:02 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:03 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:03 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:04 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:04 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:05 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:05 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:06 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Warn - 12:25:06 AM] warning: redefining module Tesla.Adapter.HttpcTest (current version defined in memory) │ 1 │ defmodule Tesla.Adapter.HttpcTest do │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ │ └─ test/tesla/adapter/httpc_test.exs:1: Tesla.Adapter.HttpcTest (module)

[Error - 10:49:02 AM] Server process exited with signal SIGKILL. [Info - 10:49:02 AM] Connection to server got closed. Server will restart. true Running /Users/ubi/.vscode/extensions/jakebecker.elixir-ls-0.20.0/elixir-ls-release/launch.sh Preferred shell is zsh, relaunching Looking for ASDF install ASDF install found in /Users/ubi/.asdf/asdf.sh, sourcing Installing ElixirLS release v0.20.0 Running in /Users/ubi/Developer/github.com/elixir-tesla/tesla Install complete [Info - 10:49:06 AM] Started ElixirLS v0.20.0 [Info - 10:49:06 AM] Running in /Users/ubi/Developer/github.com/elixir-tesla/tesla [Info - 10:49:06 AM] ElixirLS built with elixir "1.16.2" on OTP "26" [Info - 10:49:06 AM] Running on elixir "1.16.2 (compiled with Erlang/OTP 24)" on OTP "26" [Info - 10:49:06 AM] Protocols are not consolidated [Info - 10:49:06 AM] Elixir sources not found (checking in /home/runner/work/elixir/elixir). Code navigation to Elixir modules disabled. [Info - 10:49:06 AM] Received client configuration via workspace/configuration %{"additionalWatchedExtensions" => [], "autoBuild" => true, "autoInsertRequiredAlias" => true, "dialyzerEnabled" => true, "dialyzerFormat" => "dialyxir_long", "dialyzerWarnOpts" => [], "enableTestLenses" => false, "envVariables" => %{}, "fetchDeps" => false, "languageServerOverridePath" => "", "mixEnv" => "test", "mixTarget" => "", "projectDir" => "", "signatureAfterComplete" => true, "suggestSpecs" => true, "trace" => %{"server" => "off"}} [Info - 10:49:08 AM] Registering for workspace/didChangeConfiguration notifications [Info - 10:49:08 AM] Starting build with MIX_ENV: test MIX_TARGET: host [Info - 10:49:08 AM] client/registerCapability succeeded [Info - 10:49:08 AM] Registering for workspace/didChangeWatchedFiles notifications [Info - 10:49:08 AM] client/registerCapability succeeded [Warn - 10:49:08 AM] error: module Tesla.AdapterCase is not loaded and could not be found └─ nofile: Tesla.Adapter.HttpcTest (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Adapter.HttpcTest (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 1, line: 4, column: 54], line: 4, column: 3], [{:aliases, [last: [line: 4, column: 13], line: 4, column: 7], [:Tesla, :AdapterCase]}, [adapter: {:aliases, [last: [line: 4, column: 49], line: 4, column: 35], [:Tesla, :Adapter, :Httpc]}]]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla.AdapterCase.Basic is not loaded and could not be found └─ nofile: Tesla.Adapter.HttpcTest (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Adapter.HttpcTest (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 1, line: 5, column: 30], line: 5, column: 3], [{:aliases, [last: [line: 5, column: 25], line: 5, column: 7], [:Tesla, :AdapterCase, :Basic]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla.AdapterCase.Multipart is not loaded and could not be found └─ nofile: Tesla.Adapter.HttpcTest (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Adapter.HttpcTest (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 1, line: 6, column: 34], line: 6, column: 3], [{:aliases, [last: [line: 6, column: 25], line: 6, column: 7], [:Tesla, :AdapterCase, :Multipart]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla.AdapterCase.StreamRequestBody is not loaded and could not be found └─ nofile: Tesla.Adapter.HttpcTest (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Adapter.HttpcTest (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 2, line: 7, column: 42], line: 7, column: 3], [{:aliases, [last: [line: 7, column: 25], line: 7, column: 7], [:Tesla, :AdapterCase, :StreamRequestBody]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla.AdapterCase.SSL is not loaded and could not be found └─ nofile: Tesla.Adapter.HttpcTest (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Adapter.HttpcTest (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 1, line: 14, column: 6], line: 9, column: 3], [{:aliases, [last: [line: 9, column: 25], line: 9, column: 7], [:Tesla, :AdapterCase, :SSL]}, [ssl: [verify: :verify_peer, cacertfile: {{:., [line: 13, column: 23], [{:aliases, [last: [line: 13, column: 19], line: 13, column: 19], [:Path]}, :join]}, [closing: [line: 13, column: 90], line: 13, column: 24], [[{:to_string, [closing: [line: 13, column: 66], line: 13, column: 30], [{{:., [line: 13, column: 45], [:code, :priv_dir]}, [closing: [line: 13, column: 65], line: 13, column: 46], [:httparrot]}]}, "/ssl/server-ca.crt"]]}]]]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Info - 10:49:08 AM] Loaded DETS databases in 137ms [Warn - 10:49:08 AM] error: module Tesla is not loaded and could not be found └─ nofile: Tesla.Middleware.TimeoutTest.Client (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Middleware.TimeoutTest.Client (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 2, line: 5, column: 14], line: 5, column: 5], [{:aliases, [last: [line: 5, column: 9], line: 5, column: 9], [:Tesla]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla is not loaded and could not be found └─ nofile: Tesla.Middleware.TimeoutTest.DefaultTimeoutClient (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Middleware.TimeoutTest.DefaultTimeoutClient (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 2, line: 35, column: 14], line: 35, column: 5], [{:aliases, [last: [line: 35, column: 9], line: 35, column: 9], [:Tesla]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

[Warn - 10:49:08 AM] error: module Tesla is not loaded and could not be found └─ nofile: Tesla.Middleware.TimeoutTest.OtelTimeoutClient (module)

[Warn - 10:49:08 AM] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Tesla.Middleware.TimeoutTest.OtelTimeoutClient (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 2, line: 53, column: 14], line: 53, column: 5], [{:aliases, [last: [line: 53, column: 9], line: 53, column: 9], [:Tesla]}]}" (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5 (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3 (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4 (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4 (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1 (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2 (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (stdlib 5.2.1) lists.erl:1706: :lists.mapfoldl_1/3 (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4 (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4 (elixir_sense 2.0.0) lib/elixir_sense/core/metadata_builder.ex:1301: ElixirSense.Core.MetadataBuilder.pre/2

Compiling 48 files (.ex) Generated tesla app [Info - 10:49:13 AM] Compile took 4560 milliseconds [Info - 10:49:13 AM] [ElixirLS WorkspaceSymbols] Indexing... [Info - 10:49:13 AM] [ElixirLS WorkspaceSymbols] Module discovery complete [Info - 10:49:13 AM] [ElixirLS WorkspaceSymbols] 425 symbols added to index in 37ms [Info - 10:49:13 AM] [ElixirLS Dialyzer] Checking for stale beam files [Info - 10:49:13 AM] [ElixirLS Dialyzer] Found 61 changed files in 109 milliseconds [Info - 10:49:13 AM] [ElixirLS Dialyzer] Analyzing 3 modules: [MockClient, Tesla.Env, Tesla] [Info - 10:49:14 AM] [ElixirLS Dialyzer] Analysis finished in 792 milliseconds [Info - 10:49:14 AM] Dialyzer analysis is up to date [Info - 10:49:15 AM] [ElixirLS Dialyzer] Writing manifest... [Info - 10:49:16 AM] [ElixirLS Dialyzer] Done writing manifest in 1690 milliseconds. [Info - 10:49:17 AM] Success typings computed in 3258ms [Info - 10:56:08 AM] Success typings computed in 42ms [Info - 10:56:11 AM] Success typings computed in 26ms [Info - 11:00:45 AM] Success typings computed in 52ms [Info - 11:01:07 AM] Success typings computed in 42ms


</details>

yordis avatar Apr 18 '24 15:04 yordis

I have the same problem, make it almost unusable.

fnicastri avatar May 03 '24 06:05 fnicastri

Any way to reproduce this?

lukaszsamson avatar May 03 '24 06:05 lukaszsamson

it's up high cpu and memory when I saved

vuluu2k avatar May 04 '24 04:05 vuluu2k

I get this behavior even with a clean phoenix project

fnicastri avatar May 04 '24 13:05 fnicastri

same high CPU and memory problem for me, still not sure what triggers it, I got it with a simple project.

Is there a way to log some memory/threads dump of the beam.smp when killing it?

Similar environment:

  • Elixir & Erlang versions: Elixir 1.16.2, Erlang/OTP 26
  • VSCode ElixirLS version: v0.21.0
  • Operating System Version: macOS 14.4.1 (M1)

asantare avatar May 05 '24 13:05 asantare

I've found a way to reproduce it:

  • I have a project with a simple module with few functions but without use directive
  • open the project in vscode
  • open the simple module
  • write use GenServer (slowly)
  • boom, the beam.smp goes high cpu and memory usage

here the log from the pluging output window:

Warn  - 07:46:13] ** (ErlangError) Erlang error: "CompileError during metadata build pre:\nnofile: cannot compile module Genetic (errors have been logged)\nast node: {:use, [end_of_expression: [newlines: 0, line: 2, column: 12], line: 2, column: 3], [{:__aliases__, [last: [line: 2, column: 7], line: 2, column: 7], [:GenSe]}]}"
    (elixir 1.16.2) src/elixir_expand.erl:96: :elixir_expand.expand/3
    (elixir 1.16.2) src/elixir_expand.erl:548: :elixir_expand.expand_block/5
    (elixir 1.16.2) src/elixir_expand.erl:46: :elixir_expand.expand/3
    (elixir 1.16.2) src/elixir.erl:478: :elixir.quoted_to_erl/4
    (elixir 1.16.2) src/elixir.erl:346: :elixir.eval_forms/4
    (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
    (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3
    (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:24: ElixirSense.Core.MacroExpander.require_and_expand/2
    (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4
    (stdlib 5.2.3) lists.erl:1706: :lists.mapfoldl_1/3
    (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4
    (stdlib 5.2.3) lists.erl:1706: :lists.mapfoldl_1/3
    (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4
    (elixir_sense 2.0.0) lib/elixir_sense/core/macro_expander.ex:18: ElixirSense.Core.MacroExpander.expand_use/4
    (elixir_sense 2.0.0) lib/elixir_sense/core/state.ex:1689: ElixirSense.Core.State.expand/3


asantare avatar May 06 '24 05:05 asantare

hi @lukaszsamson, there is an issue on elixir-ls, somehow related, and a comment about the macro expansion.

How come the beam get stuck in high cpu usage (in loop?) when trying to expand a non existing macro? (from the log in previous comment it seems it tries to expand 'GenSe') Can it be tracked/reproduced on beam side?

asantare avatar May 06 '24 06:05 asantare

@asantare thanks, I can confirm there is an infinite loop issue with incomplete code

defmodule Some do
  use
  @spec my(number()) :: number()
  def my(abc) do
    abc + 1
  end
end

lukaszsamson avatar May 06 '24 08:05 lukaszsamson

@yordis @fnicastri @vuluu2k are your scenarios similar to what @asantare found?

lukaszsamson avatar May 06 '24 08:05 lukaszsamson

@lukaszsamson

nope, I'm sorry but I misread the topic. Probably my case is unrelated to the extension.

In my case whenever I start a Phoenix/Ecto process in the debugger the process start to eat all the memory. But I have no idea if the two cases can have something in common.

image

This was now, latest stable versions of everything.

fnicastri avatar May 06 '24 13:05 fnicastri

@fnicastri That's most likely unrelated. For reference https://github.com/elixir-lsp/elixir-ls/issues/1017

lukaszsamson avatar May 06 '24 13:05 lukaszsamson

@lukaszsamson

yep, it was me ;)

I thought I answered you but then I got overwhelmed by work...

fnicastri avatar May 06 '24 13:05 fnicastri

It could definitely be a macros problem, that, it fails to compile and then it never gets to work later.

I have run into compilation issues that keeps showing notifications messages even thou it is fixed

yordis avatar May 06 '24 20:05 yordis

@asantare issue fixed in https://github.com/elixir-lsp/elixir_sense/commit/8ec03beb7bbaa0d53dd33cb68ad98ad945cf9cf5

lukaszsamson avatar May 07 '24 05:05 lukaszsamson

@yordis can you try attaching observer to language server? To do so

  1. Create a local setup script in $XDG_CONFIG_HOME/elixir_ls/setup.sh or $HOME/.config/elixir_ls/setup.sh (whatever is defined on your system)
  2. Enable distribution in your local setup script e.g. export ELS_ELIXIR_OPTS="--sname language_server"
  3. Restart language server
  4. Run iex in terminal iex --sname foo and :observer.start() You should be able to switch node to language server and inspect what is using up the resources

lukaszsamson avatar May 07 '24 06:05 lukaszsamson

@lukaszsamson I am trying to remember to follow up on this, but it will require to wait at least until next week. Sorry!

yordis avatar May 07 '24 06:05 yordis

+1, massive resource usage seemingly after the last update

njwest avatar May 07 '24 16:05 njwest

+1 on this as well. Killing my CPU's performance.

wsbinette avatar May 07 '24 16:05 wsbinette

Same here. As soon as I type use GenServer the computer become unresponsive. Same problem after typing use Application. After I kill VSCode, it takes several minutes for computer to recover. Then, after restarting VSCode, it is usable again; until I need to use another behaviour...

Edit: Temporary solved the issue by downgrading the extension to version 0.20.0

mihaiphilip avatar May 07 '24 20:05 mihaiphilip

v0.21.1 with fix for use problem has been released.

lukaszsamson avatar May 08 '24 06:05 lukaszsamson

Thanks a lot! :green_heart:

I don't think use is the only problem though. I had it eat my entire memory again apparently on the new version and I was "only" working on seeds.exs so no use in use. It also seems to die so fast that I can't attach observer, or at least when I notice it the computer is already sluggish and then I have seconds to close vscode before all memory blows up :sweat_smile:

PragTob avatar May 08 '24 12:05 PragTob

I agree with @PragTob. It seems to get caught up on def function(), do: one line syntax as well. It kills the syntax highlighting and then my CPU goes crazy. This may be worth it's own issue report, but I'll just put this here for now.

wsbinette avatar May 08 '24 19:05 wsbinette

Screenshot 2024-05-09 at 7 56 33 PM Screenshot 2024-05-09 at 7 54 57 PM

Let me know the logs to post

HarshBalyan avatar May 09 '24 14:05 HarshBalyan

@wsbinette do you have a more complete repro? I tried def function(), do: and couldn't hit it.

@HarshBalyan please use steps from https://github.com/elixir-lsp/vscode-elixir-ls/issues/417#issuecomment-2097509466 to diagnose.

lukaszsamson avatar May 09 '24 15:05 lukaszsamson

I'm seeing the same on v0.21.1, albeit much "slower" in memory usage growth compared to previous version.

A first check seems that what is increasing is ETS usage (most of the memory according to observer is there), will try to keep an eye on which table is increasing.

xadhoom avatar May 09 '24 16:05 xadhoom

@wsbinette do you have a more complete repro? I tried def function(), do: and couldn't hit it.

I'll see if I can get a consistent repro for it 👍🏼 Might take a minute tho, sorry!

wsbinette avatar May 09 '24 18:05 wsbinette

A first check seems that what is increasing is ETS usage (most of the memory according to observer is there), will try to keep an eye on which table is increasing.

Follow up: ETS is indeed doing "something".

On the very same project, at startup I've 35 ETS tables with 542MB memory usage (by ETS itself). After sometime of working, I have 45 ETS tables, using ~1.2GB of memory. Some screenshots for reference (taken an startup and after a while). This happened in less than our hour.

erlang-ls-observer-ets-startup erlang-ls-observer-ets-2 erlang-ls-observer-ets-3

There're some duplicated tables, with same number of objects and usage, but maybe is by design. I'll keep an eye on the observer, today had a crash due to after a day of work (and no observer open :( ), so It may need time to happen again.

xadhoom avatar May 13 '24 16:05 xadhoom

Thanks @xadhoom Those duplicated tables are from the new incremental dialyzer. My hypothesis is that when it crashes it recreates the tables. I’ll work on a fix and until then I suggest switching back to the old dialyzer

lukaszsamson avatar May 13 '24 17:05 lukaszsamson

After one hour of light editing a project. just editing/removing Logger calls

Screenshot 2024-05-14 at 9 31 44 AM

fnicastri avatar May 14 '24 07:05 fnicastri

@fnicastri you can fire up the observer as explained here to check where this memory is used. Or disable the incremental dialyzer in vscode preferences.

xadhoom avatar May 14 '24 08:05 xadhoom