KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.84k stars 153 forks source link

File access errors when starting debugger #1596

Open SachsKaylee opened 5 years ago

SachsKaylee commented 5 years ago

Hello there!

I just discovered your plugin a few days back - it looks super promising. I really appreciate all the work that has already been put into this.

Describe the bug

When starting the project in debug mode via an iex -s mix launch configuration(might also happen for others, but I haven't tested them yet) thde debugger console is filled with file operation errors trying to load various erlang libraries form my /root folder.

This is strange insofar that my system does not have a root user, and there is no installation of elixir or erlang under that path.

I fully uninstalled elixir & erlang (remove, pruge, auto remove, etc.) and reinstall them aswell, to no avail.

I also had the same issue with VS Code (https://github.com/JakeBecker/vscode-elixir-ls/issues/120), and hoped that it would be an issue related to said plugin, but it seems that this is more of a general problem with my elixir installation(which literally just followed the steps outlined here: https://elixir-lang.org/install.html).

To Reproduce Steps to reproduce the behavior: (It probably isn't reproducible on your end though, but maybe you have an idea as to what might cause it)

  1. Create an iex -s mix configuration by following the steps outlined in your readme
  2. Click onthe launch in debug mode icon
  3. Errors about missing files are logged
  4. App crashes right away because libraries are missing

Expected behavior I hoped that I'd be able to use breakpoints in elixir again. Even though many people claim that a classic debugger is a bad fit for elixir it has proven really useful in the fast to just quickly inspect a variable without having to clutter the code with IEx.pry every two lines.

Interestingly enough running the project normally without a debugger attached works fine. It also used to work just fine in the past, I think it started happening after upgrading to Elixir 1.9.1 from 1.8.?.

Screenshots image

... and hundreds more of various libraries.

Logs Do you need a thread dump for furher info?

Desktop:

Erlang:

Elixir:

Plugin:

Additional context I hope that you have any cluse as to what might cause this. Or would this be an elixir issue instead of an IDE issue?

Thanks for your time.

theagilecoder commented 5 years ago

I am facing the same issue on VS Code and ElixrLS extension. Did you find any solution ?

SachsKaylee commented 5 years ago

Nope, no solution so far. As a workaround I've resorted to using edbg(https://github.com/etnt/edbg) at work for Erlang code.

Not tried it with Elixir so far though.

KronicDeth commented 5 years ago

It is unlikely you want to debug megaco, so if everything that can’t be opened is stuff you don’t want to debug, you can filter them out

KronicDeth commented 5 years ago

@theagilecoder the two debuggers did start out the same, but they have diverged since then. I can’t help with a bug in VSCode or ElixirLS. You’ll need to open a bug for their respective repos.

KronicDeth commented 5 years ago

Enoaccess is a file system permissions problem. Check your permissions on those beam files.

KronicDeth commented 5 years ago

If I had to take a guess why this is happening, newer Erlang installers have split off the old protocols like megaco and CORBA into optional installs. I don’t know why they are still on the code path though.

SachsKaylee commented 5 years ago

Thanks for taking a look into this.

I'll address your comments in order:

It is unlikely you want to debug megaco, so if everything that can’t be opened is stuff you don’t want to debug, you can filter them out

The errors shown in the screenshot don't just appear for megaco, they are shown for a huge amount of different applications(the errors overflow the amount of allowed buffered lines in my terminal). I wouldn't really mind them too much, but they cause my app to crash.

the two debuggers did start out the same, but they have diverged since then. I can’t help with a bug in VSCode or ElixirLS. You’ll need to open a bug for their respective repos.

This is the respective ElixirLS issue: https://github.com/JakeBecker/vscode-elixir-ls/issues/120

Enoaccess is a file system permissions problem. Check your permissions on those beam files.

The files don't exist at all. I do not know why Elixir tries to load the files from this location, I never installed Elixir to this location, it's not in the ERL_LIBS env, The root user was never enabled on my machine, etc..

patrick@PATRICK:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic
patrick@PATRICK:~$ cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
ERL_LIBS="/usr/lib/elixir/lib"
patrick@PATRICK:~$ ls /usr/lib/elixir/lib
eex  elixir  ex_unit  iex  logger  mix
patrick@PATRICK:~$ cat ~/.bashrc | grep ERL_LIBS
export ERL_LIBS="/usr/lib/elixir/lib"
patrick@PATRICK:~$ iex
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.8.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> System.get_env("ERL_LIBS")
"/usr/lib/elixir/lib"

If I had to take a guess why this is happening, newer Erlang installers have split off the old protocols like megaco and CORBA into optional installs. I don’t know why they are still on the code path though.

What does this mean for this issue? Is this an Erlang issue? If so, where should I report this to? If it helps, I installed Elixir via apt using the recommended installation method outlined in their instructions.

Thanks again for your time, all help on this issue is highly appreciated.

cec commented 4 years ago

I WAS facing the same problem.

It turns out that SDKs set in IntelliJ were not aligned with my system (from manual install to standard APT packages perfectly maintained by Erlang Solutions).

Removing all SDKs and adding back the ones with the correct paths solved the issue: now my debugger startup is so clean :)

@KronicDeth thanks for the awesome work on this plugin