We sometimes get the following error in our application which seems to occur because an error happens during the connection handshake.
2014-11-29 02:29:38 =ERROR REPORT====
** Generic server <0.248.0> terminating
** Last message in was connect
** When Server state == {<0.230.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"tasks">>,"mq.example.com",5672,0,0,0,infinity,none,[#Fun<amqp_auth_mechanisms.plain.3>,#Fun<amqp_auth_mechanisms.amqplain.3>],[],[]}}
** Reason for termination ==
** {function_clause,[{amqp_gen_connection,terminate,[{{badmatch,{error,closed}},[{amqp_network_connection,handshake,2,[{file,"src/amqp_network_connection.erl"},{line,190}]},{amqp_network_connection,try_handshake,3,[{file,"src/amqp_network_connection.erl"},{line,174}]},{amqp_gen_connection,handle_call,3,[{file,"src/amqp_gen_connection.erl"},{line,171}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,580}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]},{<0.230.0>,{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,"localhost",5672,0,0,0,infinity,none,[#Fun<amqp_auth_mechanisms.plain.3>,#Fun<amqp_auth_mechanisms.amqplain.3>],[],[]}}],[{file,"src/amqp_gen_connection.erl"},{line,230}]},{gen_server,terminate,6,[{file,"gen_server.erl"},{line,721}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
I'm not sure if it's a bug, or if we should be catching the issue in some other way? This code segment is pretty similar to what we have in production:
-module(client).
-include_lib("amqp_client/include/amqp_client.hrl").
-export([test/0]).
test() ->
case amqp_connection:start(#amqp_params_network{}) of
{ok, _Connection} -> "SUCCESS";
{error, _Error} -> "FAILED"
end.
Looking at the code at amqp_network_connection.erl , line 190, it seems that we are expecting that handshake_recv will only ever reply with a connection.start record, but intermittently our RabbitMQ machine fails at this point and the above error occurs.
Could someone please take a look and let me know if this is a bug in the library, or should our application be handling the badmatch condition in some other way?
We sometimes get the following error in our application which seems to occur because an error happens during the connection handshake.
I'm not sure if it's a bug, or if we should be catching the issue in some other way? This code segment is pretty similar to what we have in production:
Looking at the code at amqp_network_connection.erl , line 190, it seems that we are expecting that handshake_recv will only ever reply with a connection.start record, but intermittently our RabbitMQ machine fails at this point and the above error occurs.
Could someone please take a look and let me know if this is a bug in the library, or should our application be handling the badmatch condition in some other way?
Thanks