[erlang-questions] : : PID recycling

Raimo Niskanen raimo+erlang-questions@REDACTED
Tue Sep 9 13:14:26 CEST 2008


On Tue, Sep 09, 2008 at 10:38:54AM +0200, Zoltan Peter Toth wrote:
> Hi,
> 
> What about the case when we have a number of erlang nodes on different 
> hosts ?
> Will the epmd-s on the other hosts maintain the incarnation counter for 
> a restarted host ?
> 
> It seems to me that even if one host is restarted (or beam and epmd 
> killed on it), the
> incarnation counter continues as if the local epmd was running. So I 
> assume that
> those are the other epmd-s that keep track of that counter.
> (... or I just overlooked something ? )

Well, yes.

The incarnation counter aka creation is kept in the local epmd.
Any erlang node only registers with the local epmd. When you 
look up a node on a remote host you ask the remote epmd.
Epmd is mostly a local register on a host to map from node
to TCP/IP port number, and it also keeps the creation counter
(for the local nodes).

For a new node (also when epmd is new) the initial creation
is "randomized" in the interval 1..3 as current time in
seconds modulo 3 plus 1.

epmd_srv.c:1093:
	  node->creation = (current_time(g) % 3) + 1; /* "random" 1-3 */


> 
> Br,
>    Zoltan
> 
> Raimo Niskanen wrote:
> >On Mon, Sep 08, 2008 at 01:59:56PM +0200, Zoltan Peter Toth wrote:
> >  
> >>Hi Raimo !
> >>
> >>Thanks. So if a node completely restarts, i.e. epmd as well, then the 
> >>cycling is lost,
> >>i.e. after 0 there will be 0 again after the reboot, right ?
> >>    
> >
> >Well, 1, since nodes with names use creation 1..3,
> >but you are right.
> >
> >  

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list