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

list_unresponsive_queues crashes if a QoS 0 queue used by an MQTT client is present #11434

Closed
gomoripeti opened this issue Jun 12, 2024 · 1 comment · Fixed by #11435
Closed
Labels
Milestone

Comments

@gomoripeti
Copy link
Contributor

gomoripeti commented Jun 12, 2024

Describe the bug

RabbitMQ 3.13.x or main at b4efe04

The command rabbitmqctl list_unresponsive_queues crashes with a function clause if there is a queue of type :rabbit_mqtt_qos0_queue present. This is because rabbit_amqqueue:is_unresponsive/2 only expects the 3 known queue types (

is_unresponsive(Q, _Timeout) when ?amqqueue_state_is(Q, crashed) ->
)

Reproduction steps

  1. With a 3.13.x RabbitMQ version eg 3.13.3 enable the rabbitmq_mqtt plugin
  2. Enabe feature flag rabbit_mqtt_qos0_queue
  3. Create an MQTT connection and subscribe with QoS0 for example using emqtt client
    Options = [{host, "localhost"},
               {port, 1883},
               {ssl, false},
               {clientid, <<"guest">>},
               {username, <<"guest">>},
               {password, <<"guest">>}
              ],
    {ok, Conn} = emqtt:start_link(Options),
    {ok, _Props} = emqtt:connect(Conn),
    {ok, _, _} = emqtt:subscribe(Conn, <<"topic">>, qos0).
  4. Try to list unresponsive queues
    # sbin/rabbitmqctl list_unresponsive_queues
    Listing unresponsive queues for vhost / ...
    {:badrpc, {:EXIT, {:function_clause, [{:rabbit_amqqueue, :is_unresponsive, [{:amqqueue, {:resource, "/", :queue, "mqtt-subscription-guestqos0"}, true, false, #PID<13145.10121.0>, [], #PID<13145.10121.0>, [], [], [], :undefined, :undefined, [], [], :live, 0, [], "/", %{user: "guest"}, :rabbit_mqtt_qos0_queue, %{}}, 15000], [file: 'rabbit_amqqueue.erl', line: 1315]}, {:rabbit_amqqueue, :"-emit_unresponsive_local/5-fun-0-", 3, [file: 'rabbit_amqqueue.erl', line: 1421]}, {:rabbit_misc, :with_exit_handler, 2, [file: 'rabbit_misc.erl', line: 525]}, {:rabbit_control_misc, :step_with_exit_handler, 4, [file: 'rabbit_control_misc.erl', line: 58]}, {:rabbit_control_misc, :"-emitting_map0/5-lc$^0/1-0-", 5, [file: 'rabbit_control_misc.erl', line: 50]}, {:rabbit_control_misc, :emitting_map_with_exit_handler, 5, [file: 'rabbit_control_misc.erl', line: 46]}, {:rabbit_control_misc, :emitting_map_with_exit_handler, 4, [file: 'rabbit_control_misc.erl', line: 41]}]}}}

Expected behavior

Successfully return an empty list.

In more general terms Im not sure what should be returned for 3rd party custom queue types. The code could either always ignore queue types which are not classic, quorum or stream. Or there needs to be an optional callback of the queue type that returns if the queue is unresponsive.

Additional context

No response

@gomoripeti
Copy link
Contributor Author

thanks for promptly addressing this issue

mergify bot pushed a commit that referenced this issue Jun 12, 2024
(cherry picked from commit 18705dd)
@michaelklishin michaelklishin added this to the 3.13.4 milestone Jun 12, 2024
@michaelklishin michaelklishin changed the title list_unresponsive_queues crashes if qos0_queue present list_unresponsive_queues crashes if a QoS 0 queue used by an MQTT client is present Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants