diff options
author | dcorbacho <dparracorbacho@piotal.io> | 2021-10-13 17:47:13 +0200 |
---|---|---|
committer | dcorbacho <dparracorbacho@piotal.io> | 2021-10-13 17:51:00 +0200 |
commit | 141f95598e7d42219db486c688c7a3466398c008 (patch) | |
tree | 0786611f9a2b1a8455e11f40f149f61a61abec26 | |
parent | d48ed6dfb68cb13392a1f07039d587f3d8c05e07 (diff) | |
download | rabbitmq-server-git-coordinator-error-handling.tar.gz |
Handling of `stream_not_found` return value when init a stream clientcoordinator-error-handling
This error probably shouldn't happen if the system is correct, however
`stream_not_found` is a valid return value for the functions called
- it comes from `register_listener`.
Not handling it causes a case_clause (and long stacktrace) that is sent
to the client as an internal error, instead of a known protocol error.
Seen while debugging another issue.
-rw-r--r-- | deps/rabbit/src/rabbit_channel.erl | 5 | ||||
-rw-r--r-- | deps/rabbit/src/rabbit_stream_queue.erl | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/deps/rabbit/src/rabbit_channel.erl b/deps/rabbit/src/rabbit_channel.erl index cf4b160fcb..3b26f2811e 100644 --- a/deps/rabbit/src/rabbit_channel.erl +++ b/deps/rabbit/src/rabbit_channel.erl @@ -2174,6 +2174,11 @@ deliver_to_queues({Delivery = #delivery{message = Message = #basic_message{ex ok end, State; + {error, {stream_not_found, Resource}} -> + rabbit_misc:protocol_error( + resource_error, + "Stream not found for ~s", + [rabbit_misc:rs(Resource)]); {error, {coordinator_unavailable, Resource}} -> rabbit_misc:protocol_error( resource_error, diff --git a/deps/rabbit/src/rabbit_stream_queue.erl b/deps/rabbit/src/rabbit_stream_queue.erl index 14e83d85d3..139e84a5d0 100644 --- a/deps/rabbit/src/rabbit_stream_queue.erl +++ b/deps/rabbit/src/rabbit_stream_queue.erl @@ -652,6 +652,8 @@ init(Q) when ?is_amqqueue(Q) -> leader = Leader, writer_id = WriterId, soft_limit = SoftLimit}}; + {ok, stream_not_found, _} -> + {error, stream_not_found}; {error, coordinator_unavailable} = E -> rabbit_log:warning("Failed to start stream client ~p: coordinator unavailable", [rabbit_misc:rs(QName)]), |