diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-06-02 15:40:19 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-06-02 15:40:19 +0100 |
| commit | 5272fae5383a912a72342b28d78c28f417448e0e (patch) | |
| tree | 8d3758ca0c2c0cea90136a0d207e8d5279d73df5 /src | |
| parent | a50ca1da5dd78305807c3dca225f69fcc02f2c9b (diff) | |
| download | rabbitmq-server-git-5272fae5383a912a72342b28d78c28f417448e0e.tar.gz | |
Don't explode if the pid vanishes during is_gm_process/2. Keep on handling instrumented msgs while we are waiting for things to shut down, so that... they can.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gm_qc.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gm_qc.erl b/src/gm_qc.erl index 2da2ee7921..a7dc1ede2b 100644 --- a/src/gm_qc.erl +++ b/src/gm_qc.erl @@ -73,13 +73,22 @@ check_stale_members(All) -> end. is_gm_process(Group, P) -> - {dictionary, D} = process_info(P, dictionary), - {gm, Group} =:= proplists:get_value(process_name, D). + case process_info(P, dictionary) of + undefined -> false; + {dictionary, D} -> {gm, Group} =:= proplists:get_value(process_name, D) + end. await_death(P) -> MRef = erlang:monitor(process, P), + await_death(MRef, P). + +await_death(MRef, P) -> receive - {'DOWN', MRef, process, _, _} -> ok + {'DOWN', MRef, process, P, _} -> ok; + {'EXIT', _, normal} -> await_death(MRef, P); + {'EXIT', _, Reason} -> exit(Reason); + {instrumented, From, To, Thing} -> process_msg(From, To, Thing), + await_death(MRef, P) end. %% --------------------------------------------------------------------------- |
