Hello, I’m a beginner. Recently my server always returns an error message:
Error in process <0.29709.65> on node 'X@Y' with exit value:
{function_clause,[{dist_util,recv_name_old,[{hs_data,<0.62.0>,undefined,'X@Y',#Port<0.13427>,<0.29707.65>,0,[],undefined,undefined,undefined,fun inet_tcp:send/2,fun inet_tcp:recv/3,#Fun<inet_tcp_dist.0.90093225>,#Fun<inet_tcp_dist.1.90093225>,#Fun<inet_tcp_dist.2.90093225>,#Fun<inet_tcp_dist.3.90093225>,#Fun<inet_tcp_dist.4.90093225>,fun inet_tcp_dist:getstat/1,normal,fun inet_tcp_dist:setopts/2,fun inet_tcp_dist:getopts/2,undefined,undefined,undefined,undefined,undefined,undefined},"n"],[{file,"dist_util.erl"},{line,767}]},{dist_util,handshake_other_started,1,[{file,"dist_util.erl"},{line,199}]}]}
I changed my node name to X@Y
I checked the error location and received an “n” when I received the first handshake message from the connector.
recv_name(#hs_data{socket = Socket, f_recv = Recv} = HSData) ->
case Recv(Socket, 0, infinity) of
{ok, [$n | _] = Data} ->
recv_name_old(HSData, Data);
{ok, [$N | _] = Data} ->
recv_name_new(HSData, Data);
_ ->
?shutdown(no_node)
end.
Here the match is successful, but the corresponding argument cannot be matched after entering the method “recv_name_old”, resulting in an error
recv_name_old(HSData,
[$n, V1, V0, F3, F2, F1, F0 | Node] = Data) ->
<<_Version:16>> = <<V1,V0>>,
<<Flags:32>> = <<F3,F2,F1,F0>>,
?trace("recv_name: 'n' node=~p version=~w\n", [Node, _Version]),
case is_node_name(Node) of
true ->
check_allowed(HSData, Node),
{Flags, list_to_atom(Node), ?CREATION_UNKNOWN, ?ERL_DIST_VER_5};
false ->
?shutdown(Data)
end.
So where did the unexpected handshake message “n” come from? How can you find the source or avoid it?