Skip to content

Commit d43bc0e

Browse files
committed
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`.
1 parent 8e05c4d commit d43bc0e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/rabbit_amqqueue.erl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,8 @@ with(Name, F, E, RetriesLeft) ->
463463
{ok, Q = #amqqueue{state = crashed}} ->
464464
E({absent, Q, crashed});
465465
{ok, Q = #amqqueue{state = stopped}} ->
466-
%% If the queue process was stopped by the supervisor
467-
%% we don't want to retry an operation.
468-
rabbit_misc:with_exit_handler(
469-
fun () -> E({absent, Q, stopped})
470-
end, fun () -> F(Q) end);
466+
%% The queue process was stopped by the supervisor
467+
E({absent, Q, stopped});
471468
{ok, Q = #amqqueue{pid = QPid}} ->
472469
%% We check is_process_alive(QPid) in case we receive a
473470
%% nodedown (for example) in F() that has nothing to do

src/rabbit_channel.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,8 @@ handle_method(#'queue.delete'{queue = QueueNameBin,
21422142
fun (not_found) -> {ok, 0};
21432143
({absent, Q, crashed}) -> rabbit_amqqueue:delete_crashed(Q, Username),
21442144
{ok, 0};
2145+
({absent, Q, stopped}) -> rabbit_amqqueue:delete_crashed(Q, Username),
2146+
{ok, 0};
21452147
({absent, Q, Reason}) -> rabbit_misc:absent(Q, Reason)
21462148
end) of
21472149
{error, in_use} ->

0 commit comments

Comments
 (0)