question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ElixirLS Running two instances on Vscode

See original GitHub issue

Problem

ElixirLS runs two instances on my Vscode. They both do exactly the same work at their own pace, maxing out my CPU usage all the time. I can see two beam.smp instances in my Mac’s Activity Monitor Panel, and likewise two ElixirLS instances in Vscode’s Output panel where extensions display their logs.

Even when seemingly doing nothing (logs don’t show any new entries), they both keep maxing out my CPU.

The logs on both start with:

Started ElixirLS v0.5.0
Elixir version: "1.10.3 (compiled with Erlang/OTP 22)"
Erlang version: "22"
ElixirLS compiled with Elixir 1.7.4 and erlang 20

The logs appear constantly identical, except the times to compile files are slightly different, indicating they are indeed two different instances doing the same things at the same time.

mix.exs dependencies also have {:dialyzex, "~> 1.2.1", only: [:test, :dev]},, in case that is anyhow relevant.

I’m using asdf with the following content in my .tool-versions:

elixir 1.10.3-otp-22
erlang 22.3.4.1
nodejs 11.15.0

Environment

  • Elixir & Erlang versions (elixir --version): Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] Elixir 1.10.3 (compiled with Erlang/OTP 22)
  • Operating system: macOS Catalina 10.15.6 (just installed a major update)
  • Editor: VSCODE
  • LSP Client name: ElixirLS: Elixir support and debugger

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:11
  • Comments:26 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
accocommented, Dec 13, 2020

Just chiming in to echo that ~6 months later, the advice above still applies. I also got this and was able to resolve by just closing open “unsaved” editor windows and restarting.

In the top left of VSCode, it will tell you how many unsaved open editors you have:

I used this little window to guide my hunt. After closing all unsaved tabs and restarting VSCode, I only had one ElixirLS running.

7reactions
doughsaycommented, Jul 22, 2020

Got it!

Steps to reproduce (shortcuts are for Linux, not sure what they are for mac):

  1. mix new double_double
  2. cd double_double
  3. code . (or launch VScode however you normally do)
  4. toggle output (use the command palette or ctrl+k ctrl+h)
    • NOTE: you should have ZERO ElixirLS processes running
  5. open mix.exs in editor
    • NOTE: you should now have ONE ElixirLS process running
  6. create a new blank unsaved file (ctrl-n)
  7. change language mode to “Elixir” (use the command palette or ctrl-k m)
    • you should now have TWO ElixirLS processes running

Quitting the editor in this state and re-launching it using code . restores unsaved files, and the restoration of those files launches a secondary ElixirLS process. I keep unsaved files around for long periods of time sometimes, and this is why the double-process thing has been bothering me for quite a while 😉 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode - Elixir LS + WSL - Questions / Help
VSCode will run in Windows 10. Projects + Elixir + Erlang would run via WSL ElixirLS would need its language server to run...
Read more >
How do I open multiple instances of Visual Studio Code?
You can then use menu File → Open Folder to have two instances of Visual Studio Code with different folders in each window....
Read more >
ElixirLS: Elixir support and debugger
Extension for Visual Studio Code - Elixir support with debugger, autocomplete, and more. Powered by ElixirLS.
Read more >
Learn With Me: Elixir - Visual Studio Code and Elixir (#70)
I wanted to share what I've been using for anyone who's interested. Visual Studio Code isn't aware of Elixir by default, but it...
Read more >
Fixing "Go to Definition" for Elixir's standard library
After being spoiled for years by JetBrains' tools, using VSCode as my ... is known to break Elixir language server (ElixirLS) if turned...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found