-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function_clause
when loading a virtual host-specific definitions file at boot time
#10068
Comments
get_all(VHostName, Comp)
when (is_binary(VHostName) orelse VHostName =:= '_') andalso
(is_binary(Comp) orelse Comp =:= '_') ->
rabbit_db:run(
#{mnesia => fun() -> get_all_in_mnesia(VHostName, Comp) end}). So the function assumes that virtual host name is always present or is set to |
diff --git a/deps/rabbit/src/rabbit_db_rtparams.erl b/deps/rabbit/src/rabbit_db_rtparams.erl
index c4d86f9f25..be52cd3f88 100644
--- a/deps/rabbit/src/rabbit_db_rtparams.erl
+++ b/deps/rabbit/src/rabbit_db_rtparams.erl
@@ -175,6 +175,8 @@ get_all_in_mnesia() ->
%%
%% @private
+get_all(undefined = _VHostName, Comp) ->
+ get_all('_', Comp);
get_all(VHostName, Comp)
when (is_binary(VHostName) orelse VHostName =:= '_') andalso
(is_binary(Comp) orelse Comp =:= '_') -> may be all that's necessary. |
The queue definitions in this file do not have a virtual host, so you cannot import this file at boot time (you might be able to via the HTTP API endpoint that imports them for a specific) virtual host. Compare this definition file produced by a 3.12.10 node: "queues": [
{
"name": "sq.1",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {
"x-queue-type": "stream"
}
},
{
"name": "cq.1",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {}
},
{
"name": "qq.1",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {
"x-queue-type": "quorum"
}
}
], and one of the queues in this issue: {
"source": "ote_messages",
"destination": "ote_measurements",
"destination_type": "exchange",
"routing_key": "otemsg.121",
"arguments": {}
}, This means that in {ok, VHostMap} = filter_out_existing_queues(Queues0), |
I have verified that if you export definitions using management UI (the form with a button at the bottom) while you have All virtual host selected, you get back all definitions and all resources have the virtual host field. There are multiple different ways to avoid this confusion. On the export side:
8ba0e07 was the commit that introduced virtual host field stripping. I don't remember any details on why the virtual host was removed but it is a trivial thing to undo. |
function_clause
when loading definitions filefunction_clause
when loading a virtual host-specific definitions file at boot time
Scan queues, exchanges and bindings before attempting to import anything on boot. If they miss the virtual host field, fail early and log a sensible message.
On boot first and foremost. Log a more helpful message. See #10068 for the background.
…-and-validation Usability improvements during definition import #10068
Scan queues, exchanges and bindings before attempting to import anything on boot. If they miss the virtual host field, fail early and log a sensible message. (cherry picked from commit 62fffb6)
Scan queues, exchanges and bindings before attempting to import anything on boot. If they miss the virtual host field, fail early and log a sensible message.
On boot first and foremost. Log a more helpful message. See #10068 for the background.
Describe the bug
RabbitMQ version - 3.12.10
Originally reported here - https://groups.google.com/g/rabbitmq-users/c/oLnrjOJAxM0
Loading a provided
definitions.json
file results in the following crash at boot:RabbitMQ Boot Output
Reproduction steps
Configure RabbitMQ to load the
defititions.json
file from here:https://github.com/lukebakken/rabbitmq-users-oLnrjOJAxM0
Note that the path in
rabbitmq.conf
will have to be adjusted.Expected behavior
No crash.
Additional context
No response
The text was updated successfully, but these errors were encountered: