summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-01-27 16:39:27 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2011-01-27 16:39:27 +0000
commit4cc865d821020aedde20bdd214d73ef6e28d72f1 (patch)
tree6b568960bade46a025f4c01e994a3b4ae5cde3cc
parentd4d295da481a62a8134fa7de317a945c76b683c2 (diff)
downloadrabbitmq-server-bug23546.tar.gz
Stop the channel crashing if we requeue to a dead queuebug23546
-rw-r--r--src/rabbit_channel.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 91559ea6..cc3cfbf4 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -736,14 +736,18 @@ handle_method(#'basic.qos'{prefetch_count = PrefetchCount},
handle_method(#'basic.recover_async'{requeue = true},
_, State = #ch{unacked_message_q = UAMQ}) ->
+ OkFun = fun () -> ok end,
ok = fold_per_queue(
fun (QPid, MsgIds, ok) ->
%% The Qpid python test suite incorrectly assumes
%% that messages will be requeued in their original
%% order. To keep it happy we reverse the id list
%% since we are given them in reverse order.
- rabbit_amqqueue:requeue(
- QPid, lists:reverse(MsgIds), self())
+ rabbit_misc:with_exit_handler(
+ OkFun, fun () ->
+ rabbit_amqqueue:requeue(
+ QPid, lists:reverse(MsgIds), self())
+ end)
end, ok, UAMQ),
%% No answer required - basic.recover is the newer, synchronous
%% variant of this method