[erlang-questions] Using 'monitor' with spawn_opt/3 throws badarg. How to monitor a remote process?

Kenneth Lakin kennethlakin@REDACTED
Tue Feb 24 07:34:43 CET 2015


Roger Lipscombe asks:
> How do I monitor a process that I spawn on a remote node?

Some searching pulls up this message from a similar thread:
http://erlang.org/pipermail/erlang-questions/2014-March/078380.html
and this reply:
http://erlang.org/pipermail/erlang-questions/2014-March/078395.html

I *think* that that thread says that monitoring of remote processes is
not supported by the distribution protocol. I probably seriously
misunderstand what's going on, but it sort of looks like this program
indicates that you *can* monitor remote processes:

Fun = fun() -> timer:sleep(timer:seconds(5)),
  io:format("Hello from ~p~n", [node()]) end,
Pid = spawn_opt(one@REDACTED, Fun, [link]),
monitor(process, Pid),
timer:sleep(timer:seconds(5+1)),
flush().

Hello from one@REDACTED
Shell got {'DOWN',#Ref<0.0.0.452>,process,<7323.94.0>,normal}
ok

Again. I'm probably deeply confused here.

-Kenneth Lakin

PS: Apologies for breaking threading. I just joined the list. (And,
apologies to the moderator for the earlier half-composed email!)



More information about the erlang-questions mailing list