<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:·s²Ó©úÅé
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I have been trying to use gproc with
https://github.com/garret-smith/gen_leader_revival. I found that
registering a name which is already registered will destroy the existing
registration of the name, and a remote node is unaware of this. See
the following steps:<br>
<br>
<br>
Register node1 shell as global name 'abcde' on node1, the name is
visable on node2 and sending messages from node2 shell to 'abcde' works
fine:<br>
<br>
<tt>(node1)1> gproc:reg({n, g, abcde}).</tt><tt><br>
</tt><tt>true</tt><tt><br>
</tt><tt>(node1)2> gproc:where({n, g, abcde}).</tt><tt><br>
</tt><tt><0.229.0></tt><tt><br>
</tt><tt><br>
</tt><tt>(node2)1> gproc:where({n, g, abcde}).</tt><tt><br>
</tt><tt><8049.229.0></tt><tt><br>
</tt><tt>(node2)2> gproc:send({n, g, abcde}, hello).</tt><tt><br>
</tt><tt>hello</tt><tt><br>
</tt><tt><br>
</tt><tt>(node1)3> flush().</tt><tt><br>
</tt><tt>Shell got hello</tt><tt><br>
</tt><tt>ok</tt><tt><br>
</tt><br>
<br>
Now on node1 shell register with the name again, it removes the existing registration:<br>
<br>
<tt>(node1)4> gproc:reg({n, g, abcde}).</tt><tt><br>
</tt><tt>** exception error: bad argument</tt><tt><br>
</tt><tt> in function gproc:reg/1</tt><tt><br>
</tt><tt> called as gproc:reg({n,g,abcde})</tt><tt><br>
</tt><tt>(node1)5> gproc:where({n, g, abcde}).</tt><tt><br>
</tt><tt>undefined</tt><br>
<br>
<br>
But on node2 the shell still gets <8049.229.0>:<br>
<br>
<tt>(node2)3> gproc:where({n, g, abcde}).</tt><tt><br>
</tt><tt><8049.229.0></tt><br>
<br>
<br>
And sending message from node2 shell to 'abcde' still works 'fine', but the node1 shell doesn't get any message:<br>
<tt><br>
</tt><tt>(node2)4> gproc:send({n, g, abcde}, hello).</tt><tt><br>
</tt><tt>hello</tt><tt><br>
</tt><tt><br>
</tt><tt>(node1)6> flush().</tt><tt><br>
</tt><tt>ok</tt><tt><br>
</tt><br>
<br>
Now if I register node1 shell as {n, g, abcde} again, everything works fine again:<br>
<br>
<tt>(node1)7> gproc:reg({n, g, abcde}).</tt><tt><br>
</tt><tt>true</tt><tt><br>
</tt><tt><br>
</tt><tt>(node2)5> gproc:where({n, g, abcde}).</tt><tt><br>
</tt><tt><8049.268.0></tt><tt><br>
</tt><tt>(node2)6> gproc:send({n, g, abcde}, hello).</tt><tt><br>
</tt><tt>hello</tt><tt><br>
</tt><tt><br>
</tt><tt>(node1) 8> flush().</tt><tt><br>
</tt><tt>Shell got hello</tt><tt><br>
</tt><tt>ok</tt><br>
<br>
<br>
This doesn't look right to me.<br>
1) When registering with a name already registered, why doesn't gproc return something like {error, already_registered}?<br>
2) After the registration is removed, why does a remove node still sees the non-existent registration?<br>
<br>
<br>
Thanks<br>
Khitai </div></body>
</html>