Skip to content

Commit

Permalink
Merge pull request #12352 from rabbitmq/mqtt-max-packet-size
Browse files Browse the repository at this point in the history
Decrease default MQTT Maximum Packet Size
  • Loading branch information
michaelklishin authored Sep 21, 2024
2 parents 83f2875 + bddc546 commit bfdf4fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
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).

0 comments on commit bfdf4fb

Please sign in to comment.