bug in pid()?

Rickard Green rickard.s.green@REDACTED
Wed Aug 6 10:12:20 CEST 2003


Hi,

Comment cut from external.c:

/*
  *   Valid creations for nodes are 1, 2, or 3. 0 can also be sent
  *   as creation, though. When 0 is used as creation, the real creation
  *   is unknown. Creation 0 on data will be changed to current
  *   creation of the node which it belongs to when it enters
  *   that node.
  *       This typically happens when a remote pid is created with
  *   list_to_pid/1 and then sent to the remote node. This behavior
  *   has the undesirable effect that a pid can be passed between nodes,
  *   and as a result of that not being equal to itself (the pid that
  *   comes back isn't equal to the original pid).
  *
  */

c:pid/3 uses list_to_pid/1 when creating the pid.

Note that list_to_pid/1 and c:pid/3 are only intended to be used for 
debugging and testing. They should not be used in application programs.

Regards,
Rickard Green, Erlang/OTP


Daniel Solaz wrote:
> is this a bug?
> 
> node1> self().
> <0,41,0>
> node1> global:register_name(shell1, self()).
> yes
> node1> global:whereis_name(shell1) == pid(0, 41, 0).
> true
> 
> node2> global:whereis_name(shell1) == pid(3822, 41, 0).
> false
> 
> comparison is true when pid is local but false when remote
> 
> tested with
> R9B-1 and P9C (July 28) on FreeBSD/x86
> R9B-1 on Linux/x86 and Linux/HPPA
> 
> 





More information about the erlang-questions mailing list