summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Fedotov <fedotov.danil@gmail.com>2017-07-27 14:36:46 +0100
committerDaniil Fedotov <fedotov.danil@gmail.com>2017-07-27 14:36:46 +0100
commitd43bc0e408d1c2a89df399840e072fc427176c2c (patch)
tree58fe4dba8863b02a2c772a3aa09a135006cbab25 /src
parent8e05c4dbf362f61d2e4c12de59ae1e3997f2fcd2 (diff)
downloadrabbitmq-server-git-d43bc0e408d1c2a89df399840e072fc427176c2c.tar.gz
Do not try to perform a queue operation in `rabbit_amqqueue:with` if the queue is stopped.
The only operation in `with` which can be performed on a stopped queue is `delete`. It will call `delete_crashed` based on the `{absent, Q, stopped}` result from `with`.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue.erl7
-rw-r--r--src/rabbit_channel.erl2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 605634891e..5537634144 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -463,11 +463,8 @@ with(Name, F, E, RetriesLeft) ->
{ok, Q = #amqqueue{state = crashed}} ->
E({absent, Q, crashed});
{ok, Q = #amqqueue{state = stopped}} ->
- %% If the queue process was stopped by the supervisor
- %% we don't want to retry an operation.
- rabbit_misc:with_exit_handler(
- fun () -> E({absent, Q, stopped})
- end, fun () -> F(Q) end);
+ %% The queue process was stopped by the supervisor
+ E({absent, Q, stopped});
{ok, Q = #amqqueue{pid = QPid}} ->
%% We check is_process_alive(QPid) in case we receive a
%% nodedown (for example) in F() that has nothing to do
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 00a6607dfb..c69a27d57c 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -2142,6 +2142,8 @@ handle_method(#'queue.delete'{queue = QueueNameBin,
fun (not_found) -> {ok, 0};
({absent, Q, crashed}) -> rabbit_amqqueue:delete_crashed(Q, Username),
{ok, 0};
+ ({absent, Q, stopped}) -> rabbit_amqqueue:delete_crashed(Q, Username),
+ {ok, 0};
({absent, Q, Reason}) -> rabbit_misc:absent(Q, Reason)
end) of
{error, in_use} ->