nats-io/nats.ex

TCP Errors => Badmatch

mmmries opened this issue · 1 comments

I got a rather unhelpful error report today from my system and as I tracked it down the logs around the time of the error look like this:

21:23:18.427 [info] [83, 83, 76, 58, 32, 83, 111, 99, 107, 101, 116, 32, 101, 114, 114, 111, 114, 58, 32, 'etimedout', 32, '\n']
21:23:18.428 [error] connection failed {{:badmatch, {:error, :closed}}, [{Gnat, :handle_call, 3, [file: 'lib/gnat.ex', line: 218]}, {:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 615]}, {:gen_server, :handle_msg, 5, [file: 'gen_server.erl', line: 647]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}
21:23:18.461 [error] GenServer :rpc_gnat terminating
** (MatchError) no match of right hand side value: {:error, :closed}
    lib/gnat.ex:218: Gnat.handle_call/3
    (stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:647: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:unsub, 421, [max_messages: 2]}

The failure resulted in my connection restarting and it re-established the connection just fine, but it would be nice to have a better error message, something like "tcp connection to nats failed with error {:error, :closed}, crashing the process so we can start fresh".

This hasn't been a problem for a long time, closing