Skip to content
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

Be more defensive when importing definitions where some virtual hosts do not have a default queue type #10891

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

tomyouyou
Copy link
Contributor

the version of erlang is erlang-25.3.2.6-1.el8.x86_64.
the version of rabbitmq-server is rabbitmq-server-3.12.10-1.

To reproduce the exception as follows:

  1. rabbitmqctl export_definitions def.json

  2. rabbitmqctl import_definitions def.json

  3. The result of ''rabbit_definitions:list_vhosts()' is: [root@c1 ssl]# rabbitmqctl eval 'rabbit_definitions:list_vhosts().' [#{<<"limits">> => [],
    <<"metadata">> =>
    #{default_queue_type => undefined,
    description => <<"Default virtual host">>,tags => []},
    <<"name">> => <<"/">>}

  4. rabbitmqctl export_definitions def.json

  5. rabbitmqctl import_definitions def.json

  6. The result of ''rabbit_definitions:list_vhosts()' is: [root@c1 ssl]# rabbitmqctl eval 'rabbit_definitions:list_vhosts().' [#{<<"limits">> => [],
    <<"metadata">> =>
    #{default_queue_type => <<"undefined">>,
    description => <<"Default virtual host">>,tags => []},
    <<"name">> => <<"/">>}

  7. Declare a queue and an exception will appear, as shown below: 2024-03-29 17:38:09.696 [error] <0.1441.0> ** Generic server <0.1441.0> terminating, ** Last message in was {'$gen_cast', {method, {'queue.declare',0,<<"q12">>,false,false, false,false,false,[]}, none,noflow}}, ** When Server state == {ch, {conf,running,rabbit_framing_amqp_0_9_1,1, <0.1432.0>,<0.1439.0>,<0.1432.0>, <<"10.225.80.5:40388 -> 10.225.80.5:5673">>, undefined, {user,<<"guest">>, [administrator], [{rabbit_auth_backend_internal, #Fun<rabbit_auth_backend_internal.3.2577553>}]}, <<"/">>,<<>>,<0.1433.0>, [{<<"authentication_failure_close">>,bool,true}, {<<"basic.nack">>,bool,true}, {<<"connection.blocked">>,bool,true}, {<<"consumer_cancel_notify">>,bool,true}, {<<"publisher_confirms">>,bool,true}], none,0,134217728,1800000,#{},1000000000,false}, {lstate,<0.1440.0>,false}, none,1, {0,[],[]}, {state,#{},erlang}, #{},#{}, {state,fine,30000, #Ref<0.3663679405.4218945538.136240>}, true,1, {rabbit_confirms,undefined,#{}}, [],[],none,flow,[], {rabbit_queue_type,#{}}, #Ref<0.3663679405.4218945537.194739>,false, {erlang,#Ref<0.3663679405.4218945537.194740>}, "none",false}, ** Reason for termination == , ** {function_clause, [{rabbit_queue_type,discover, [<<"undefined">>], [{file,"rabbit_queue_type.erl"},{line,225}]}, {rabbit_amqqueue,augment_declare_args,5, [{file,"rabbit_amqqueue.erl"},{line,804}]}, {rabbit_channel,handle_method,6, [{file,"rabbit_channel.erl"},{line,2762}]}, {rabbit_channel,handle_method,3, [{file,"rabbit_channel.erl"},{line,1828}]}, {rabbit_channel,handle_cast,2, [{file,"rabbit_channel.erl"},{line,728}]}, {gen_server2,handle_msg,2,[{file,"gen_server2.erl"},{line,1056}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]},

…tions

the version of erlang is erlang-25.3.2.6-1.el8.x86_64.
the version of rabbitmq-server is rabbitmq-server-3.12.10-1.

To reproduce the exception as follows:
1. rabbitmqctl export_definitions def.json
2. rabbitmqctl import_definitions def.json
3. The result of ''rabbit_definitions:list_vhosts()' is:
[root@c1 ssl]#  rabbitmqctl eval 'rabbit_definitions:list_vhosts().'
[#{<<"limits">> => [],
   <<"metadata">> =>
       #{default_queue_type => undefined,
         description => <<"Default virtual host">>,tags => []},
   <<"name">> => <<"/">>}

4. rabbitmqctl export_definitions def.json
5. rabbitmqctl import_definitions def.json
6. The result of ''rabbit_definitions:list_vhosts()' is:
[root@c1 ssl]#  rabbitmqctl eval 'rabbit_definitions:list_vhosts().'
[#{<<"limits">> => [],
   <<"metadata">> =>
       #{default_queue_type => <<"undefined">>,
         description => <<"Default virtual host">>,tags => []},
   <<"name">> => <<"/">>}
7. Declare a queue and an exception will appear, as shown below:
2024-03-29 17:38:09.696 [error] <0.1441.0> ** Generic server <0.1441.0> terminating, ** Last message in was {'$gen_cast', {method, {'queue.declare',0,<<"q12">>,false,false, false,false,false,[]}, none,noflow}}, ** When Server state == {ch, {conf,running,rabbit_framing_amqp_0_9_1,1, <0.1432.0>,<0.1439.0>,<0.1432.0>, <<"10.225.80.5:40388 -> 10.225.80.5:5673">>, undefined, {user,<<"guest">>, [administrator], [{rabbit_auth_backend_internal, #Fun<rabbit_auth_backend_internal.3.2577553>}]}, <<"/">>,<<>>,<0.1433.0>, [{<<"authentication_failure_close">>,bool,true}, {<<"basic.nack">>,bool,true}, {<<"connection.blocked">>,bool,true}, {<<"consumer_cancel_notify">>,bool,true}, {<<"publisher_confirms">>,bool,true}], none,0,134217728,1800000,#{},1000000000,false}, {lstate,<0.1440.0>,false}, none,1, {0,[],[]}, {state,#{},erlang}, #{},#{}, {state,fine,30000, #Ref<0.3663679405.4218945538.136240>}, true,1, {rabbit_confirms,undefined,#{}}, [],[],none,flow,[], {rabbit_queue_type,#{}}, #Ref<0.3663679405.4218945537.194739>,false, {erlang,#Ref<0.3663679405.4218945537.194740>}, "none",false}, ** Reason for termination == , ** {function_clause, [{rabbit_queue_type,discover, [<<"undefined">>], [{file,"rabbit_queue_type.erl"},{line,225}]}, {rabbit_amqqueue,augment_declare_args,5, [{file,"rabbit_amqqueue.erl"},{line,804}]}, {rabbit_channel,handle_method,6, [{file,"rabbit_channel.erl"},{line,2762}]}, {rabbit_channel,handle_method,3, [{file,"rabbit_channel.erl"},{line,1828}]}, {rabbit_channel,handle_cast,2, [{file,"rabbit_channel.erl"},{line,728}]}, {gen_server2,handle_msg,2,[{file,"gen_server2.erl"},{line,1056}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]},
@lukebakken
Copy link
Collaborator

lukebakken commented Apr 1, 2024

See this issue - #10470

@lukebakken lukebakken closed this Apr 1, 2024
@lukebakken lukebakken reopened this Apr 1, 2024
@lukebakken lukebakken self-assigned this Apr 1, 2024
@michaelklishin michaelklishin changed the title An exception occurred while declaring a queue, after importing defini… Be more defensive when importing definitions where some virtual hosts do not have a default queue type Apr 1, 2024
michaelklishin added a commit that referenced this pull request Apr 2, 2024
@michaelklishin michaelklishin merged commit 94701c6 into rabbitmq:main Apr 2, 2024
17 of 21 checks passed
mergify bot pushed a commit that referenced this pull request Apr 2, 2024
(cherry picked from commit fb05a51)
mergify bot pushed a commit that referenced this pull request Apr 2, 2024
(cherry picked from commit fb05a51)
(cherry picked from commit 7c9beef)
@tomyouyou tomyouyou deleted the rabbitmq_put_vhost branch April 8, 2024 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants