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

Decrease default MQTT Maximum Packet Size #12352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deps/rabbitmq_mqtt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ APP_ENV = """[
{mailbox_soft_limit, 200},
{max_packet_size_unauthenticated, 65536},
%% 256 MB is upper limit defined by MQTT spec
{max_packet_size_authenticated, 268435455},
%% We set 16 MB as defined in deps/rabbit/Makefile max_message_size
{max_packet_size_authenticated, 16777216},
{topic_alias_maximum, 16}
]
"""
Expand Down
3 changes: 2 additions & 1 deletion deps/rabbitmq_mqtt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ define PROJECT_ENV
{mailbox_soft_limit, 200},
{max_packet_size_unauthenticated, 65536},
%% 256 MB is upper limit defined by MQTT spec
{max_packet_size_authenticated, 268435455},
%% We set 16 MB as defined in deps/rabbit/Makefile max_message_size
{max_packet_size_authenticated, 16777216},
{topic_alias_maximum, 16}
]
endef
Expand Down
2 changes: 2 additions & 0 deletions deps/rabbitmq_mqtt/src/rabbit_mqtt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ persist_static_configuration() ->

{ok, MaxSizeAuth} = application:get_env(?APP_NAME, max_packet_size_authenticated),
assert_valid_max_packet_size(MaxSizeAuth),
{ok, MaxMsgSize} = application:get_env(rabbit, max_message_size),
?assert(MaxSizeAuth =< MaxMsgSize),
ok = persistent_term:put(?PERSISTENT_TERM_MAX_PACKET_SIZE_AUTHENTICATED, MaxSizeAuth).

assert_valid_max_packet_size(Val) ->
Expand Down
5 changes: 5 additions & 0 deletions release-notes/4.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## RabbitMQ 4.1.0

## Potential incompatibilities

* The default MQTT [Maximum Packet Size](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901086) changed from 256 MiB to 16 MiB. This default can be overriden by [configuring](https://www.rabbitmq.com/docs/configure#config-file) `mqtt.max_packet_size_authenticated`. Note that this value must not be greater than `max_message_size` (which also defaults to 16 MiB).
Loading