summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordcorbacho <dparracorbacho@piotal.io>2020-02-07 12:59:59 +0100
committerdcorbacho <dparracorbacho@piotal.io>2020-02-07 12:59:59 +0100
commit165df7988960420c6996c5097679be11ef2db5a0 (patch)
tree5ee9bea32822bcf7305ad7422ba41f0fc359ccb8
parent685adeb6cdc27e56c40427f1c5cd3a81ee2da7d4 (diff)
downloadrabbitmq-server-git-165df7988960420c6996c5097679be11ef2db5a0.tar.gz
Avoid crash of osiris metrics if writer is down
-rw-r--r--src/rabbit_osiris_metrics.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rabbit_osiris_metrics.erl b/src/rabbit_osiris_metrics.erl
index 010855a1c0..90017a90e9 100644
--- a/src/rabbit_osiris_metrics.erl
+++ b/src/rabbit_osiris_metrics.erl
@@ -58,7 +58,19 @@ handle_info(tick, #state{timeout = Timeout} = State) ->
_ -> Offs
end,
rabbit_core_metrics:queue_stats(QName, COffs, 0, COffs, 0),
- Infos = rabbit_stream2_queue:infos(QName),
+ Infos = try
+ rabbit_stream2_queue:infos(QName)
+ catch
+ _:_ ->
+ %% It's possible that the writer has died but
+ %% it's still on the amqqueue record, so the
+ %% `erlang:process_info/2` calls will return
+ %% `undefined` and crash with a badmatch.
+ %% At least for now, skipping the metrics might
+ %% be the best option. Otherwise this brings
+ %% down `rabbit_sup` and the whole `rabbit` app.
+ []
+ end,
rabbit_core_metrics:queue_stats(QName, Infos),
ok;
(_, _V) ->