Skip to content

Commit

Permalink
Merge pull request rabbitmq#923 from rabbitmq/rabbitmq-server-922
Browse files Browse the repository at this point in the history
Discard any unexpected messages, such as late replies from gen_server
  • Loading branch information
michaelklishin authored Aug 16, 2016
2 parents 4d4144e + 878b6a0 commit b02d325
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/gm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,10 @@ handle_info({'DOWN', MRef, process, _Pid, Reason},
catch
lost_membership ->
{stop, normal, State}
end.
end;
handle_info(_, State) ->
%% Discard any unexpected messages, such as late replies from neighbour_call/2
noreply(State).

terminate(Reason, #state { module = Module, callback_args = Args }) ->
Module:handle_terminate(Args, Reason).
Expand Down
11 changes: 10 additions & 1 deletion test/gm_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ all() ->
broadcast,
confirmed_broadcast,
member_death,
receive_in_order
receive_in_order,
unexpected_msg
].

init_per_suite(Config) ->
Expand Down Expand Up @@ -114,6 +115,14 @@ receive_in_order(_Config) ->
passed
end).

unexpected_msg(_Config) ->
passed = with_two_members(
fun(Pid, _) ->
Pid ! {make_ref(), old_gen_server_answer},
true = erlang:is_process_alive(Pid),
passed
end).

do_broadcast(Fun) ->
with_two_members(broadcast_fun(Fun)).

Expand Down

0 comments on commit b02d325

Please sign in to comment.