intellij-elixir icon indicating copy to clipboard operation
intellij-elixir copied to clipboard

Debugger Error - rejected since it cannot handle [~c"V4_NC", ~c"UNLINK_ID"]

Open jlirochon opened this issue 9 months ago • 8 comments

Describe the bug The debugger can not connect, and I am unable to debug the application. Same as reported by @RuBAN-GT here

To Reproduce Steps to reproduce the behavior:

  1. Create a Phoenix Framework project using mix phx.new
  2. Open the project
  3. Configure Erlang SDK and Elixir SDK
  4. Create a Run/Debug configuration with type: Elixir / Mix and mix arguments: phx.server
  5. Launch Debug session

Expected behavior The debugger should be able to connect.

Logs

16:10:01.616 [error] ** :"[email protected]": Connection attempt from node :"[email protected]" rejected since it cannot handle [~c"V4_NC", ~c"UNLINK_ID"].**

Waiting for debugger to attach...

16:10:01.721 [error] ** :"[email protected]": Connection attempt from node :"[email protected]" rejected since it cannot handle [~c"V4_NC", ~c"UNLINK_ID"].**


16:10:01.823 [error] ** :"[email protected]": Connection attempt from node :"[email protected]" rejected since it cannot handle [~c"V4_NC", ~c"UNLINK_ID"].**

Desktop:

  • Chip: Apple M1
  • OS: macOS Ventura
  • Version: 13.5.2 (22G91)

Erlang:

  • Installer: Homebrew
  • Version: 26.0.2

Elixir:

  • Installer: Homebrew
  • Version: 1.15.6

IDE:

  • Version: IntelliJ IDEA 2023.2.2 (Ultimate Edition)
  • Build: Build #IU-232.9921.47, built on September 12, 2023

Plugin:

  • Version: 16.0.0

jlirochon avatar Sep 22 '23 14:09 jlirochon

I was able to make it work by replacing OtpErlang.jar in intellij-erlang and intellij-elixir plugins. I didn't test everything but the debugger is connected and I was able to use a breakpoint.

Here is what I did, if it can help someone.

# Remove existing build
asdf uninstall erlang 26.1

# java 17 is required to compile jinterface
# I had openjdk-20 installed with Homebrew, but the IDE won't load OtpErlang.jar unless compiled with java 17 or lower
brew uninstall openjdk
asdf plugin add java
asdf install java openjdk-17.0.2

# Erlang configure script won't detect asdf shims, so just put javac on the $PATH
export PATH="$HOME/.asdf/installs/java/openjdk-17.0.2/bin:$PATH"

# Installing erlang 26.1 will compile jinterface
asdf install erlang 26.1

# Install elixir if not already installed
asdf install elixir 1.15.6-otp-26

# Copy `OtpErlang.jar` to `intellij-erlang` and `intellij-elixir`
export JINTERFACE_JAR="$HOME/.asdf/installs/erlang/26.1/lib/jinterface-1.14/priv/OtpErlang.jar"
export PLUGINS_DIR="$HOME/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.9921.47/IntelliJ IDEA.app.plugins"
cp "$JINTERFACE_JAR" "$PLUGINS_DIR/intellij-erlang/lib"
cp "$JINTERFACE_JAR" "$PLUGINS_DIR/intellij-elixir/lib"

Restart the IDE, and don't forget to select the corresponding Erlang SDK and Elixir SDK.

jlirochon avatar Sep 22 '23 21:09 jlirochon

Thanks @jlirochon it worked!

regismesquita avatar Nov 03 '23 18:11 regismesquita

Actualy this worked for me also. I had java openjdk-17.0.2 already installed but erlang 26.0.2 and elixir through brew. It seems the brew package brings OtpErlang.jar already compiled, maybe with openjdk-20 so it did not work on my setup. What I did:

brew uninstall elixir
brew uninstall erlang

Download erlang sources 26.0.2 from their website (because at the time of writing this is the version that brew offered) and do:
./configure && make && make install

Find OtpErlang.jar within /usr/local/lib/erlang , and place it in intellij-erlang/lib and intellij-elixir/lib replacing the current one.

brew install erlang
brew install elixir

Restart Intellij IDE and change the erlang-for-elixir SDK to use the locally compiled erlang in /usr/local/lib/erlang

pakore avatar Nov 13 '23 19:11 pakore

Reproduced with Intellij 2023.3.3, and plugin version 17.0, well, probably as expected.

Do I get it correctly that the essense of an issue is that starting from OTP26 a particular library which is a part of plugin (lib/OtpErlang.jar in both plugin sources and final destination) needs to be compiled differently from how it was for OTP25 and earlier? Since it's all java bytecode then it can be compiled on any machine and just copied to whichever other machine,

I guess the challenge is that plugin should somehow be able to automagically load one version for OTP25 and earlier / another version for OTP26 and later.

If it is indeed so, could somebody kindly just attach an OTP26-compatible jar to this ticket? Copying this file to the proper locations could be a workaround for those who aren't feeling comfortable enough for rebuilding libraries (me included, but I guess many others would find it useful as well).

@jlirochon , @regismesquita , @pakore , would it be possible for you to share?

amarchen avatar Jan 31 '24 17:01 amarchen

I'm experiencing this issue too. Thanks for documenting your workaround @jlirochon

Yes, @amarchen I believe you have the essence of the issue correct. If the original plugin author can build and bundle a "OtpErlang.jar" file inside the plugin distribution, then I don't see a reason why a new "OtpErlang.jar" built by a trusted collaborator wouldn't also be fine to use in its place.

Is this project even still maintained, aside from some occasional bumps to support the newest IntelliJ version? There are issues piling up and there hasn't really been any bugfixes committed in the last 12 months. (Not throwing shade, I am an open source maintainer myself, I know it is thankless and can be overwhelming).

I will create a new github Issue named "Bundled OtpErlang.jar does not support OTP v26+" to better highlight this issue.

ashleysommer avatar Mar 30 '24 13:03 ashleysommer

When DockYard started a formal R&D department and I moved worked to LiveViewNative I effectively lost my DockYard Fridays because only billable employees on client projects get those. I was working 5 days a week on LiveViewNative and didn't have as much time to work on the project. It also didn't help that Brian Cardarella, the CEO of DockYard said there was no ROI on the project when I asked to give talks about it. It kinda took the motivation out of spending 10s of hours a week on it. Because all the R&D projects (Lumen/FireFly, VLC plugin, and LiveView Native) I worked on at DockYard were in Rust and not Elixir I didn't have a lot of day-to-day pain points where I needed to add features to the plugin. DockYard had 4 layoffs over about 18 months and I got hit with the 3rd round at the end of the year. Having put 9-10 years of work into this project and struggling to find an Elixir position since the DockYard layoffs has made me question whether devoting more time to the plugin and to Elixir in general is worth it. I had a blip of a job in February when Peridio, Justin Schneck's new startup, was founded, but they hired me before they understood what their VC funding wouldn't cover my position and so converted me to a contractor for that one month and let me go. It was far easier and faster to get a Ruby on Rails job with 2 years of experience in the language in the Austin, TX in the 2010s (a couple weeks of looking) than it is for me to get an Elixir job with 10 years of experience in the language, multiple conference talks, and this plugin.

KronicDeth avatar Mar 30 '24 13:03 KronicDeth

@amarchen Here is the new OtpErlang that I built, its based on the JInterface v1.14 source bundled with latest Erlang/OTP v26.2.3 Built using OpenJDK-17 on ArchLinux. OtpErlang.zip

ashleysommer avatar Mar 30 '24 23:03 ashleysommer

@ashleysommer . Thank you - worked for me!

@KronicDeth it's a pity the situation for you is such, I can only express gratitude for making this plugin. Maintaining open source is hard and not particularly thankful effort apparently, so let me at least thank you. Your work helped and helps.

amarchen avatar Apr 01 '24 19:04 amarchen