[erlang-questions] processes spawned on remote nodes don't run
Khitai Pang
khitai.pang@REDACTED
Tue Dec 6 10:34:48 CET 2016
Hi,
I have the following function in user_default.erl:
run_on_all_nodes() ->
[spawn(Node, fun() ->
io:format("This runs on ~p~n", [node()])
end) || Node <- nodes()].
When I run this function, processes can be spawned on remote nodes but
it seems that they don't run:
(myapp@REDACTED)1> nodes().
[myapp@REDACTED,rabbit@REDACTED,rabbit@REDACTED]
(myapp@REDACTED)2> run_on_all_nodes().
[<27616.12336.0>,<27612.15341.39>,<27615.22399.50>]
If I manually run the spawn command in the attached shell, it all works
fine:
(myapp@REDACTED)3> [spawn(Node, fun() -> io:format("This runs on ~p~n",
[node()]) end) || Node <- nodes()].
This runs on myapp@REDACTED
This runs on rabbit@REDACTED
This runs on rabbit@REDACTED
[<27616.12339.0>,<27612.15569.39>,<27615.22640.50>]
Any idea?
Thanks
Khitai
More information about the erlang-questions
mailing list