KronicDeth / intellij-elixir

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

Debugger fails to start (elixir 1.17.2/ OTP 27.0.1 #3629

Open psteininger opened 3 months ago

psteininger commented 3 months ago

I tried running a mix phx.server configuration in debug mode . I have OTP 27.0.1 and elixir 1.17.2-otp-27 installed via mise/asdf. The erlang and Elixir SDKs are the only ones in the list and the elixir 1.17.2-otp-27 is the selected SDK.

To Reproduce Steps to reproduce the behavior:

  1. Setup a run configuration as a mix task with phx.server as mix arguments
  2. Run the configuration in debug
  3. Scroll down to '....'
  4. See error

Expected behavior Debugger starts and attaches to the process

Screenshots

image

Logs

Waiting for debugger to attach...
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/eex/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/elixir/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/ex_unit/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/iex/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/logger/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/mix/ebin...  ...skipped
Interpreting modules under /Users/piotr/.local/share/mise/installs/erlang/27.0.1/lib/asn1-5.3/ebin...

23:11:18.169 [error] GenServer IntelliJElixir.Debugger.Server terminating
** (UndefinedFunctionError) function :int.interpretable/1 is undefined (module :int is not available)
    :int.interpretable(:asn1_db)
    /private/var/folders/br/smkky7lx2zlf42fz6fh6yv280000gn/T/intellij_elixir11/debugger/lib/intellij_elixir/debugger/server.ex:400: anonymous fn/1 in IntelliJElixir.Debugger.Server.interpret_modules_in/2
    (elixir 1.17.2) lib/stream.ex:523: anonymous fn/4 in Stream.filter/2
    (elixir 1.17.2) lib/enum.ex:4858: Enumerable.List.reduce/3
    (elixir 1.17.2) lib/stream.ex:1891: Enumerable.Stream.do_each/4
    (elixir 1.17.2) lib/enum.ex:4423: Enum.each/2
    /private/var/folders/br/smkky7lx2zlf42fz6fh6yv280000gn/T/intellij_elixir11/debugger/lib/intellij_elixir/debugger/server.ex:401: IntelliJElixir.Debugger.Server.interpret_modules_in/2
    /private/var/folders/br/smkky7lx2zlf42fz6fh6yv280000gn/T/intellij_elixir11/debugger/lib/intellij_elixir/debugger/server.ex:133: anonymous fn/3 in IntelliJElixir.Debugger.Server.handle_call/3
Last message (from #PID<11621.4.0>): {:interpret, %{sdk_paths: ["/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/logger/ebin", "/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/elixir/ebin", "/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/ex_unit/ebin", "/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/mix/ebin", "/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/eex/ebin", "/Users/piotr/.local/share/mise/installs/elixir/1.17.2-otp-27/lib/iex/ebin"], reject_elixir_module_name_patterns: [":cow*", ":crypto", ":elixir_*", ":erocksdb", ":lz4", ":ranch*", ":re2", "Access", "Agent", "Agent.*", "Application", "Atom", "Base", "Bcrypt.Base", "Behaviour", "Benchee", "Benchee.*", "Bitwise", "Calendar", "Calendar.*", "Code", "Code.*", "Collectable", "Collectable.*", "Connection", "Credo", "Credo.*", "DBConnection", "DBConnection.*", "Date", "Date.*", "DateTime", "Decimal", "Dict", "DynamicSupervisor", "ESpec", "ESpec.*", "Earmark", "Earmark.*", "Ecto", "Ecto.*", "Enum", "Enumerable", "Enumerable.*", "ExCoveralls", "ExCoveralls.*", ...]}}
State: %IntelliJElixir.Debugger.Server{attached: nil, evaluate_meta_pid_to_froms: %{}}
Client #PID<11621.4.0> is remote on node :"debugger8b0874dd-fab3-4517-b03c-0378eff29bfc@127.0.0.1"

Desktop:

Erlang:

Elixir:

Plugin:

psteininger commented 3 months ago

this is quite odd, because when I run iex, the module :int and all the functions are there. Also running the line below returns true

% iex   
Erlang/OTP 27 [erts-15.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>  :int.interpretable(:asn1_db)
true
iex(2)> 
psteininger commented 3 months ago

Small Update: I managed to get further by adding :* to the list of interpreted modules:

image

However, I got a different error:

23:33:49.981 [error] GenServer IntelliJElixir.Debugger.Server terminating
** (UndefinedFunctionError) function :int.auto_attach/2 is undefined (module :int is not available)
    :int.auto_attach([:break], {IntelliJElixir.Debugger.Server, :breakpoint_reached, []})
    /private/var/folders/br/smkky7lx2zlf42fz6fh6yv280000gn/T/intellij_elixir9/debugger/lib/intellij_elixir/debugger/server.ex:94: IntelliJElixir.Debugger.Server.handle_call/3
    (stdlib 6.0.1) gen_server.erl:2209: :gen_server.try_handle_call/4
    (stdlib 6.0.1) gen_server.erl:2238: :gen_server.handle_msg/6
    (stdlib 6.0.1) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message (from #PID<12153.4.0>): :attach
State: %IntelliJElixir.Debugger.Server{attached: nil, evaluate_meta_pid_to_froms: %{}}
Client #PID<12153.4.0> is remote on node :"debuggerff782bc2-b96a-469a-80a5-c5f434e80272@127.0.0.1"

Would anyone suggest other things to try or a workaround?

joshuataylor commented 3 months ago

I'll write a guide about this, it is a pain to get to work as you need to juggle modules.

amplexdenmark commented 2 months ago

I am having the exact same issue. The setup guide would be much appreciated

ativ97 commented 2 months ago

Did anyone find a workaround yet? Been struggling with this issue for a few days. I'm also fairly new to elixir.

Fahani commented 2 months ago

Having the same issue, I posted it here https://elixirforum.com/t/error-while-debugging-phoenix-app-ubuntu-24-intellij-ultimate/66239

Were you able to work on that guide @joshuataylor ?