Let’s assume I have the following Erlang nodes architecture
A <-> B <-> C
- A is connected to B
- B is connected to C
- A IS NOT connected to C
Why the following RPC call from A to B to C fails?
% we are on node A
rpc:call('b@myhost', rpc, call, [c@myhost', io, format, ["Node: ~w~n", [node()]]])
The error is
(a@myhost)1> net_kernel:connect_node('b@myhost').
true
(a@myhost)2> rpc:call('b@myhost', rpc, call, ['c@myhost', io, format, ["Node: ~w~n", [node()]]]).
{badrpc, {'EXIT',{terminated,[{io,format,
["Node: ~w~n",[a@myhost]],
[{file, "io.erl"},
{line,198},
{error_info,#{cause => {io, terminated},
module => erl_stdlib_errors}}]}]}}}
Nodes are started with the following command
erl -sname a -connect_all false -kernel dist_auto_connect never -setcookie cookie