Determining if process is alive on a different node

Claes Wikstrom klacke@REDACTED
Mon Aug 15 23:37:42 CEST 2005


Serge Aleynikov wrote:

> (b@REDACTED)3> ^C
> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
>        (v)ersion (k)ill (D)b-tables (d)istribution
> a
> ~/tmp>erl -sname b
> Erlang (BEAM) emulator version 5.4.8 [source] [hipe] [threads:0]
> Eshell V5.4.8  (abort with ^G)
> (b@REDACTED)1> net_adm:ping(a@REDACTED).
> pong
> 
> (a@REDACTED)5> rpc:call(b@REDACTED, erlang, is_process_alive, 
> [pid(4771,36,0)]).
> true
> 
> --------------
> This last statement is not true, since it is not the same process on 
> node b that originated the first message.  The Pid that was originally 
> recorded was reassigned to another process after the node was bounced.


I'm not sure and haven't checked the current source. But in the stoneage
when I first wrote the code for distributed erlang there was a small
counter in each Pid which was somehow incremented when a node was
started.

Thus the node incarnation is checked and Pids from old dead nodes
albeit with the right name are discarded and an error message
is printed.

The error above is the use of:

pid(4771,36,0)

You should collect the pid from the remote node, bind it to variable,
restart the remote node and see that the old Pid is not useable.
I checked, and if I try to use a Pid from a dead node, message is
just discarded.


/klacke



More information about the erlang-questions mailing list