[erlang-bugs] implementation of pg library not what it should be

Johan Montelius johanmon@REDACTED
Sat Mar 7 08:55:27 CET 2009


Looking at the implementation of pg I think some improvements could be done.

Look at how pg:join/2 is implemented. It sends a message to the group manager and then waits for a reply. Now we could of course have this strange situation:

5> pg:create(foo).
ok
6> self() ! {gurka, {members, strange}}, pg:join(foo, self()).
strange

Since the receive statement in pg:join/2 will accept any message on the form {_,{members,_}} things will not behave as expected.

The pg module is "experimental" but it doues not give the guarantees that it claims:  "When messages are sent to the named group, all members of the group receive the message." This is of course only true if messages actually arrive (which is not guaranteed by Erlang send opeation). Even if send was reliable we coudl end up with only half of the members receiving a message if the group manager dies. 


  Johan




More information about the erlang-bugs mailing list