<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I have a question about internal structure of pid and possibility to compare pids in distributed system.</div><div style="font-family:arial,sans-serif;font-size:13px">I see strange (for me) behavior of erlang (version 17.1) and I need help to explain this.</div><div style="font-family:arial,sans-serif;font-size:13px">My case is:</div><div style="font-family:arial,sans-serif;font-size:13px">I have 2 connected nodes.</div><div style="font-family:arial,sans-serif;font-size:13px"><ol><li style="margin-left:15px">On node 1 I generate a pid P (<0.X.0>)</li><li style="margin-left:15px">P is transfered to node 2 (on node 2 I receive it as <Y.X.0>)</li><li style="margin-left:15px">P is transfered back from node 2 to node 1 (I'm receiving it as P2)</li><li style="margin-left:15px">P2 is recognized as local pid (<0.X.0>)</li><li style="margin-left:15px">I can compare P and P2 on node 1 and they are identical</li><li style="margin-left:15px">I'm restarting node 1</li><li style="margin-left:15px">On node 1 I generate the same pid P as in step 1 (<0.X.0>)</li><li style="margin-left:15px">I repeat step 3, again receive initial pid as P2</li><li style="margin-left:15px">P2 is recognized as local pid (<0.X.0>) - as before</li><li style="margin-left:15px">But now P == P2 returns false.</li><li style="margin-left:15px">Also P == list_to_pid(pid_to_list(P2)) returns true</li></ol><div>Could someone explain this behavior?</div></div><div style="font-family:arial,sans-serif;font-size:13px">What is changing in internal pid representation after node restart so comparison in step 10 returns false? And why comparison in step 11 returns true?</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">My code (first lines for node 1, after empty line code for node 2):</div><div style="font-family:arial,sans-serif;font-size:13px">------------<br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>erl -sname n1 -setcookie t</div><div> </div><div>erl -sname n2 -setcookie t</div><div>------------</div><div>net_kernel:connect_node('n2@somename').</div><div>global:register_name(n1, self()).</div><div> </div><div>global:register_name(n2, self()).</div><div>------------</div><div>P = pid(0,1,0).</div><div>global:send(n2, P).</div><div> </div><div>receive P -> P end.</div><div>------------</div><div>receive P2 -> P2 end.</div><div>P == P2. % this will return true</div><div> </div><div>global:send(n1, P).</div><div>------------</div><div>%restart n1</div><div>net_kernel:connect_node('n2@somename').</div><div>global:register_name(n1, self()).</div><div>P = pid(0,1,0).</div><div>receive P2 -> P2 end.</div><div>P == P2. % this will return false</div><div> </div><div>global:send(n1, P).</div><div>------------<br></div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks,</div><div style="font-family:arial,sans-serif;font-size:13px">Pavel</div></div>