flambard / CLERIC

Common Lisp Erlang Interface
http://common-lisp.net/project/cleric/
MIT License
33 stars 8 forks source link

Connecting to Elixir or Erlang node with OTP 23 fails due to missing capabilities BIG_CREATION, UTF8_ATOMS, NEW_FUN_TAGS #12

Open dg1sbg opened 4 years ago

dg1sbg commented 4 years ago

While connecting to an Elixir node (based on Erlang/OTP 23) I get:

On the Elixir node in iex: "08:08:43.722 [error] :"node1@127.0.0.1": Connection attempt from node :lispnode@localhost rejected since it cannot handle ['BIG_CREATION', 'UTF8_ATOMS', 'NEW_FUN_TAGS']."

On the Lisp side (AllegroCL 10.1 Enterprise Edition):

<HANDSHAKE-FAILED-ERROR @ #x100079433f2>

[Condition of type COMMON-LISP-ERLANG-INTERFACE:HANDSHAKE-FAILED-ERROR]

Backtrace: 0: (ERROR COMMON-LISP-ERLANG-INTERFACE:HANDSHAKE-FAILED-ERROR :REASON "Connection not allowed") Locals: EXCL::DATUM = COMMON-LISP-ERLANG-INTERFACE:HANDSHAKE-FAILED-ERROR EXCL::ARGUMENTS = (:REASON "Connection not allowed") EXCL::LOCAL-0 = (:REASON "Connection not allowed") (:DEAD EXCL::LOCAL-1) = COMMON-LISP-ERLANG-INTERFACE:HANDSHAKE-FAILED-ERROR (:DEAD EXCL::LOCAL-2) = #(22659694466373723 T (CLERIC-HANDSHAKE-PROTOCOL::MESSAGE-LENGTH CLERIC-HANDSHAKE-PROTOCOL::TAG CLERIC-HANDSHAKE-PROTOCOL:STATUS) #() # 0 ...) (:DEAD EXCL::LOCAL-3) = #<COMMON-LISP-ERLANG-INTERFACE:HANDSHAKE-FAILED-ERROR @ #x100079433f2> (:DEAD EXCL::LOCAL-4) = 97 :UNKNOWN = NIL

I truly need this to work. May I get support on enabling these features? Thank you!

// Frank

flambard commented 4 years ago

Hi,

Thanks for reporting this!

It has been a long time since I touched this code, but I will try to solve it. Looks like the protocol has been extended with a couple new types that needs to be added to https://github.com/flambard/cl-erlang-term

dg1sbg commented 4 years ago

@flambard

Hi Markus,

I really appreciate your help here. I was really surprised to get an immediate reply here, given that you hadn't changed anything for a few years here. As Elixir and so the Erlang VM are getting more attraction and more and more apps are built based on those, I see a need to make Lisp a good citizen and keep up with Erlang developments. So: Big thanks!! If you want me to take over some parts I am really open to dive in deep.

Regards Frank (a.k.a frgo on IRC).

igoralmeida commented 1 year ago

Hi all,

I took a stab at this with https://github.com/flambard/CLERIC/pull/14 and https://github.com/flambard/cl-erlang-term/pull/7

Tested with IEx 1.14.0 (compiled with Erlang/OTP 25). Here's some auxiliary code:

(defvar *msg-queue* (list))
;;... other defvars for *elx-node-name* and *cookie*

(defun keepalive-thread ()
  (loop doing
    (let ((msgs (cleric:receive-node-messages)))
      (when (> (length msgs) 0)
        (format t "got messages!")
        (push msgs *msg-queue*)))))

#|
;; connect
(let ((node (cleric-epmd:lookup-node *elx-node-name*)))
   (cleric:remote-node-connect node *cookie*))

;; use a separate thread to respond to tick messages
(bt:make-thread #'keepalive-thread :name "keepalivethread")

;; send a message to a registered process on the elixir side
(let ((local-pid (cleric:make-pid)))
  (cleric:reg-send local-pid "iex_cl_receiver" *elx-node-name* "Hello from CL, elixir!"))
|#
defmodule ClericTest.Cl do

  def myinit() do
    pid = spawn(__MODULE__, :iex_receiver, [])
    Process.register(pid, :iex_cl_receiver)
  end

  def iex_receiver() do
    receive do
      msg -> IO.puts(msg)
    end
    iex_receiver()
  end

end

Then ClericTest.Cl.myinit() and send({:one,:"lispnode@localhost"}, {:two,:three,"four"}) in iex to send messages to CL.

Hope this helps.

muswawir commented 1 year ago

Only utf8_atoms and maps as far as I can tell, are missing in cl-erlang-term, the distribution protocal was updated in otp-23 and compatibility with the old version was removed in otp-25. To resolve the issues, the distribution protocal handshake in cleric needs to be updated to that of otp-25, utf8_atom support added to cl-erlang-term, cl-epmd still works fine.

Compatibility with versions less than otp-23 will be lost.