fix distributed monitor(Key, standby) when the name is not yet registered #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Steps to reproduce the bug in original version:
INIT:
node1:
erl -sname n1 -pa ebin -pa deps/*/ebin
node2:
erl -sname n2 -pa ebin -pa deps/*/ebin
node1:
net_adm:ping('n2@carcharodon'), application:ensure_started(gproc), gproc_dist:start_link(all).
node2:
net_adm:ping('n1@carcharodon'), application:ensure_started(gproc), gproc_dist:start_link(all).
TEST:
node1:
gproc:monitor({n, g, test}, standby).
=ERROR REPORT==== 7-May-2016::21:09:29 ===
** Generic leader gproc_dist terminating
** Last message in was {'$leader_call',
{<0.45.0>,#Ref<0.0.2.214>},
{monitor,{n,g,test},<0.45.0>,standby}}
** When Server state == {state,false,true,[]}
** Reason for termination ==
** {function_clause,[{gproc_dist,insert_reg,
[[],
{n,g,test},
undefined,<0.45.0>,
{failover,<0.45.0>}],
[{file,"src/gproc_dist.erl"},{line,1027}]},
{gproc_dist,handle_leader_call,4,
[{file,"src/gproc_dist.erl"},{line,397}]},
{gen_leader,handle_msg,4,
[{file,"src/gen_leader.erl"},{line,1103}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,240}]}]}
** exception exit: function_clause
in function gproc_dist:insert_reg/5
called as gproc_dist:insert_reg([],{n,g,test},undefined,<0.45.0>,{failover,<0.45.0>})
in call from gproc_dist:handle_leader_call/4 (src/gproc_dist.erl, line 397)
in call from gen_leader:handle_msg/4 (src/gen_leader.erl, line 1103)
in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)
With fix applied:
INIT:
...
TEST:
node1:
gproc:monitor({n, g, test}, standby).
Ref<0.0.2.234>
flush().
Shell got {gproc,{failover,<0.45.0>},#Ref<0.0.2.234>,{n,g,test}}
node2:
gproc:where({n, g, test}).
<15262.45.0>