nats-io / elixir-nats

Elixir NATS client
MIT License
76 stars 14 forks source link

"0.1.6" - no function clause matching in Nats.Connection.send_packet/2 #47

Closed ajose01 closed 5 years ago

ajose01 commented 5 years ago

I've been scratching my head on this now for a few... tried both with a remote nats and a localhost nats, same error:

23:00:32.175 [error] GenServer #PID<6858.5843.0> terminating
** (FunctionClauseError) no function clause matching in Nats.Connection.send_packet/2
    lib/nats/connection.ex:169: Nats.Connection.send_packet({:write_flush, {:msg, 108, "CONNECT {\"lang\": \"elixir\", \"name\": \"elixir-nats\", \"pedantic\": false, \"verbose\": false, \"version\": \"0.1.4\"}\r\n"}, true, {:packet_flushed, #PID<6858.5843.0>, #Reference<6858.2267846929.1015021569.234781>}}, %{ack_ref: #Reference<6858.2267846929.1015021569.234781>, close_fn: &:gen_tcp.close/1, make_active: true, opts: %{auth: %{}, host: "172.17.0.2", port: 4222, socket_opts: [:binary, {:active, :once}], ssl_opts: [], timeout: 5000, tls_required: false, verbose: false}, ps: nil, send_fn: &:gen_tcp.send/2, sep_writer: true, sock: #Port<6858.1958>, state: :ack_connect, worker: #PID<6858.5842.0>, writer_pid: nil})
    lib/nats/connection.ex:350: Nats.Connection.nats_info/2
    lib/nats/connection.ex:284: Nats.Connection.handle_packet/2
    lib/nats/connection.ex:270: Nats.Connection.transport_input/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Any thoughts?

aby2503 commented 5 years ago

I've been scratching my head on this now for a few... tried both with a remote nats and a localhost nats, same error:

23:00:32.175 [error] GenServer #PID<6858.5843.0> terminating
** (FunctionClauseError) no function clause matching in Nats.Connection.send_packet/2
    lib/nats/connection.ex:169: Nats.Connection.send_packet({:write_flush, {:msg, 108, "CONNECT {\"lang\": \"elixir\", \"name\": \"elixir-nats\", \"pedantic\": false, \"verbose\": false, \"version\": \"0.1.4\"}\r\n"}, true, {:packet_flushed, #PID<6858.5843.0>, #Reference<6858.2267846929.1015021569.234781>}}, %{ack_ref: #Reference<6858.2267846929.1015021569.234781>, close_fn: &:gen_tcp.close/1, make_active: true, opts: %{auth: %{}, host: "172.17.0.2", port: 4222, socket_opts: [:binary, {:active, :once}], ssl_opts: [], timeout: 5000, tls_required: false, verbose: false}, ps: nil, send_fn: &:gen_tcp.send/2, sep_writer: true, sock: #Port<6858.1958>, state: :ack_connect, worker: #PID<6858.5842.0>, writer_pid: nil})
    lib/nats/connection.ex:350: Nats.Connection.nats_info/2
    lib/nats/connection.ex:284: Nats.Connection.handle_packet/2
    lib/nats/connection.ex:270: Nats.Connection.transport_input/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Any thoughts?

I had similar error, when updated elixir to 1.7 and erlang to 21 OTP. Try to downgrade versions

aby2503 commented 5 years ago

Especially, try to use erlang esl-erlang_20.3-1 and elixir elixir_1.6.6-1

ryancurtin commented 5 years ago

@ajose01 - I had a chance to look at this today and created a fork with what I believe to be a working version. I ran the code through the formatter so it may be hard to pick up exactly what I changed, but the gist of it is in the following lines:

Basically, there were a bunch of unsafe variables set inside of if blocks / case statements. Once I've verified everything's working correctly I'll add a PR here.

aby2503 commented 5 years ago

@ajose01 - I had a chance to look at this today and created a fork with what I believe to be a working version. I ran the code through the formatter so it may be hard to pick up exactly what I changed, but the gist of it is in the following lines:

Basically, there were a bunch of unsafe variables set inside of if blocks / case statements. Once I've verified everything's working correctly I'll add a PR here.

Hello, is the final far ?

ryancurtin commented 5 years ago

I'll try to get a PR over the weekend - no guarantees for when they merge it though!

ryancurtin commented 5 years ago

@aby2503 - PR is here

ColinSullivan1 commented 5 years ago

Thank you all for using NATS! Note that this client has largely been unmaintained and so has been deprecated. Moving forward we suggest you migrate to the nats.ex client which will be actively maintained. We'll keep this repository public in case you'd prefer to make a copy to maintain yourselves, but hope you'll have a good experience with the new client. We sincerely apologize for the inconvenience.