diff options
| author | Michael Klishin <michael@novemberain.com> | 2017-10-25 20:09:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-25 20:09:51 +0300 |
| commit | 47f168b7a8326b0cc859a91e8089c965af85c061 (patch) | |
| tree | dac35cc1fd6ee2ae58e7b5f36bca409d9d530655 | |
| parent | b55f79da5fd50ead74308d8ad3bcf7121dac38c4 (diff) | |
| parent | 1711dd0bcaedd7a1b34f05e9d2f40285f621941a (diff) | |
| download | rabbitmq-server-git-47f168b7a8326b0cc859a91e8089c965af85c061.tar.gz | |
Merge pull request #1402 from rabbitmq/lrb-qa-152075395
Handle errors returned via RPC during shutdown
| -rw-r--r-- | src/rabbit_control_main.erl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index d220ab3802..fe9777a07d 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -285,16 +285,29 @@ shutdown_node_and_wait_pid_to_stop(Node, Pid, Inform) -> "RabbitMQ node ~p running at PID ~s successfully shut down", [Node, Pid]), Res; - {error, Err} -> - {error, {error_during_shutdown, Err}}; - _ -> - Res + % NB: this is the return value for any errors raised by + % an RPC call to rabbit:stop_and_halt. We return error_during_shutdown + % so that rabbit_cli:main can differentiate this error from + % other badrpc errors + {badrpc, {'EXIT', RpcErr}} -> + {error, {error_during_shutdown, RpcErr}}; + % NB: rabbit_cli:main pretty-prints other badrpc errors using + % rabbit_nodes:diagnostics, so don't modify the error here. + Error -> Error end. action(shutdown, Node, [], _Opts, Inform) -> case rpc:call(Node, os, getpid, []) of Pid when is_list(Pid) -> shutdown_node_and_wait_pid_to_stop(Node, Pid, Inform); + % NB: this is the rpc return value for any errors raised by + % rpc:call. We return error_during_shutdown so that + % rabbit_cli:main can differentiate this error from other badrpc + % errors + {badrpc, {'EXIT', RpcErr}} -> + {error, {error_during_shutdown, RpcErr}}; + % NB: rabbit_cli:main pretty-prints other badrpc errors using + % rabbit_nodes:diagnostics, so don't modify the error here. Error -> Error end; |
