Determining if process is alive on a different node

Ulf Wiger (AL/EAB) <>
Tue Aug 16 08:48:16 CEST 2005


Klacke is right, as this simple example shows:

%% on one node, register a process:

Eshell V5.4.7  (abort with ^G)
()1> register(remote, self()).
true

%% on the other node, find the process, check that it's alive:

Eshell V5.4.7  (abort with ^G)
()1> Pid = rpc:call(, erlang, whereis, [remote]).

<4950.44.0>
()2> rpc:call(, erlang, is_process_alive, [Pid]).      
true

%% now killing 

()3> rpc:call(, erlang, is_process_alive, [Pid]).
{badrpc,nodedown}

%% restarting 

()4> rpc:call(, erlang, is_process_alive, [Pid]).
false


/Uffe

> -----Original Message-----
> From: 
> [mailto:]On Behalf Of Joel Reymont
> Sent: den 16 augusti 2005 00:04
> To: Erlang Users' List
> Subject: Re: Determining if process is alive on a different node
> 
> 
> I have a setup with multiple game servers. If a game server dies  
> players should be able to reconnect to a different game server. All  
> game servers share a database.
> 
> Even if I monitor every process on every node all nodes could  
> potentially crash and I'll still need to verify the processes when I  
> restart the cluster.
> 
> If Klacke is right about Erlang tracking node incarnations then I do  
> not have a problem and can just rpc:call(... is_process_alive ).
> 
> On Aug 15, 2005, at 9:51 PM, Serge Aleynikov wrote:
> 
> > What if the node(Pid) node got bounced since the time we captured  
> > the Pid.  The Pid value might've been reassigned to another  
> > process, as in the example below:
> 



More information about the erlang-questions mailing list