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

A new command for Web MQTT connection listing #10693 #9302 #10761

Merged
merged 11 commits into from Mar 19, 2024

Conversation

michaelklishin
Copy link
Member

This is #10693 by @LoisSotoLopez with the necessary Bazel build system updates.

Closes #9302.

@mergify mergify bot added the bazel label Mar 16, 2024
@michaelklishin michaelklishin marked this pull request as draft March 16, 2024 22:03
@michaelklishin michaelklishin changed the title Cloudamqp fix/9302 list webmqtt connections A new command for Web MQTT connection listing #10693 #9302 Mar 16, 2024
@michaelklishin
Copy link
Member Author

The new command suite in mixed cluster version still fails with

=== === Reason: no match of right hand side value 
                 [{badrpc,
                      {'EXIT',
                          {undef,
                              [{rabbit_web_mqtt_app,
                                   emit_connection_info_local,
                                   [[],#Ref<0.4241247191.103809025.44488>,
                                    <0.146.0>],
                                   []}]}}}]
  in function  command_SUITE:run/1 (command_SUITE.erl, line 84)

which is a build system-level issue.

We will either fix it or remove the mixed cluster version. This command is new and we can expect that it won't be executed before all cluster nodes are upgraded (at least this is not a risky assumption to make).

@michaelklishin michaelklishin marked this pull request as ready for review March 17, 2024 03:46
@michaelklishin michaelklishin merged commit f7697c3 into main Mar 19, 2024
19 checks passed
@michaelklishin michaelklishin deleted the cloudamqp-fix/9302-list-webmqtt-connections branch March 19, 2024 00:20
michaelklishin added a commit that referenced this pull request Mar 19, 2024
A new command for Web MQTT connection listing #10693 #9302 (backport #10761)
deps/rabbitmq_mqtt/test/command_SUITE.erl Show resolved Hide resolved
list_local_connections_of_protocol(Protocol) ->
case ranch_ref_of_protocol(Protocol) of
undefined -> [];
AcceptorRef -> ranch:procs(AcceptorRef, connections)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function calls
supervisor:which_children/1 which documents:

Notice that calling this function when supervising many children under low memory conditions can cause an out of memory exception.

So, this implementation is dangerous when there are many connections, which is typical for MQTT.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, there isn't a more efficient way to do it in Ranch. Introducing connection tracking tables for Web MQTT would completely change the stope of this PR, which is meant to be a bug fix.

deps/rabbitmq_mqtt/include/rabbit_mqtt.hrl Show resolved Hide resolved
{clientid, rabbit_data_coercion:to_binary(ClientId)}
] ++ WsOpts ++ AdditionalOpts,
{ok, C} = emqtt:start_link(Options),
{C, Connect}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a copy of a part of deps/rabbitmq_mqtt/test/util.erl.
Is it possible to reuse that file instead of copying code?
The Web MQTT plugin already depends on the MQTT plugin.

ansd added a commit that referenced this pull request Mar 21, 2024
PR #10761 added a new CLI command to list Web MQTT connections.
That new CLI command relies on feature flag delete_ra_cluster_mqtt_node
being enabled.

This commit ensures exactly this condition.
ansd added a commit that referenced this pull request Mar 21, 2024
Fixes #10761 (comment) :
"Could you please check a real condition that the old
version can't be used as part of this test?
is_mixed_versions() will still return true in 10 years
when testing RabbitMQ 21.x against 22.x. This function should
almost never be used."
@ansd ansd mentioned this pull request Mar 21, 2024
michaelklishin added a commit that referenced this pull request Mar 21, 2024
mergify bot pushed a commit that referenced this pull request Mar 21, 2024
PR #10761 added a new CLI command to list Web MQTT connections.
That new CLI command relies on feature flag delete_ra_cluster_mqtt_node
being enabled.

This commit ensures exactly this condition.

(cherry picked from commit 8233db0)
mergify bot pushed a commit that referenced this pull request Mar 21, 2024
Fixes #10761 (comment) :
"Could you please check a real condition that the old
version can't be used as part of this test?
is_mixed_versions() will still return true in 10 years
when testing RabbitMQ 21.x against 22.x. This function should
almost never be used."

(cherry picked from commit 3fd96b5)
michaelklishin added a commit that referenced this pull request Mar 21, 2024
michaelklishin pushed a commit that referenced this pull request Mar 27, 2024
PR #10761 added a new CLI command to list Web MQTT connections.
That new CLI command relies on feature flag delete_ra_cluster_mqtt_node
being enabled.

This commit ensures exactly this condition.
michaelklishin pushed a commit that referenced this pull request Mar 27, 2024
Fixes #10761 (comment) :
"Could you please check a real condition that the old
version can't be used as part of this test?
is_mixed_versions() will still return true in 10 years
when testing RabbitMQ 21.x against 22.x. This function should
almost never be used."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants