Skip to content

Commit

Permalink
Merge pull request #11455 from rabbitmq/default-max-message-size
Browse files Browse the repository at this point in the history
Reduce default maximum message size to 16MB
  • Loading branch information
michaelklishin authored Jun 14, 2024
2 parents 1723798 + c11b812 commit 6605a73
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
10 changes: 8 additions & 2 deletions deps/amqp10_client/test/system_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ stop_amqp10_client_app(Config) ->
init_per_group(rabbitmq, Config0) ->
Config = rabbit_ct_helpers:set_config(Config0,
{sasl, {plain, <<"guest">>, <<"guest">>}}),
rabbit_ct_helpers:run_steps(Config, rabbit_ct_broker_helpers:setup_steps());
Config1 = rabbit_ct_helpers:merge_app_env(Config,
[{rabbit,
[{max_message_size, 134217728}]}]),
rabbit_ct_helpers:run_steps(Config1, rabbit_ct_broker_helpers:setup_steps());

init_per_group(rabbitmq_strict, Config0) ->
Config = rabbit_ct_helpers:set_config(Config0,
{sasl, {plain, <<"guest">>, <<"guest">>}}),
Config1 = rabbit_ct_helpers:merge_app_env(Config,
[{rabbit,
[{amqp1_0_default_user, none}]}]),
[{amqp1_0_default_user, none},
{max_message_size, 134217728}]}]),
rabbit_ct_helpers:run_steps(Config1, rabbit_ct_broker_helpers:setup_steps());

init_per_group(activemq, Config0) ->
Config = rabbit_ct_helpers:set_config(Config0, {sasl, anon}),
rabbit_ct_helpers:run_steps(Config,
Expand Down
4 changes: 2 additions & 2 deletions deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ _APP_ENV = """[
{default_consumer_prefetch, {false, 0}},
%% interval at which the channel can perform periodic actions
{channel_tick_interval, 60000},
%% Default max message size is 128 MB
{max_message_size, 134217728},
%% Default max message size is 16 MB
{max_message_size, 16777216},
%% Socket writer will run GC every 1 GB of outgoing data
{writer_gc_threshold, 1000000000},
%% interval at which connection/channel tracking executes post operations
Expand Down
4 changes: 2 additions & 2 deletions deps/rabbit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ define PROJECT_ENV
{default_consumer_prefetch, {false, 0}},
%% interval at which the channel can perform periodic actions
{channel_tick_interval, 60000},
%% Default max message size is 128 MB
{max_message_size, 134217728},
%% Default max message size is 16 MB
{max_message_size, 16777216},
%% Socket writer will run GC every 1 GB of outgoing data
{writer_gc_threshold, 1000000000},
%% interval at which connection/channel tracking executes post operations
Expand Down
26 changes: 21 additions & 5 deletions deps/rabbit/test/message_size_limit_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@

all() ->
[
{group, tests}
{group, tests},
{group, default}
].

groups() ->
[
{tests, [], [
max_message_size
]}
]},
{default, [], [
default_max_message_size
]}
].

suite() ->
Expand Down Expand Up @@ -70,9 +74,6 @@ max_message_size(Config) ->
Binary6M = gen_binary_mb(6),
Binary10M = gen_binary_mb(10),

Size2Mb = 1024 * 1024 * 2,
Size2Mb = byte_size(Binary2M),

ok = rabbit_ct_broker_helpers:rpc(Config, persistent_term, put, [max_message_size, 1024 * 1024 * 3]),

{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
Expand Down Expand Up @@ -104,6 +105,21 @@ max_message_size(Config) ->
amqp_channel:call(Ch1, #'basic.publish'{routing_key = <<"none">>}, #amqp_msg{payload = Binary10M}),
assert_channel_fail_max_size(Ch1, Monitor1).

default_max_message_size(Config) ->
Binary15M = gen_binary_mb(15),
Binary17M = gen_binary_mb(20),

{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),

%% Binary is within the default max size limit of 16MB
amqp_channel:call(Ch, #'basic.publish'{routing_key = <<"none">>}, #amqp_msg{payload = Binary15M}),
%% The channel process is alive
assert_channel_alive(Ch),

Monitor = monitor(process, Ch),
amqp_channel:call(Ch, #'basic.publish'{routing_key = <<"none">>}, #amqp_msg{payload = Binary17M}),
assert_channel_fail_max_size(Ch, Monitor).

%% -------------------------------------------------------------------
%% Implementation
%% -------------------------------------------------------------------
Expand Down

0 comments on commit 6605a73

Please sign in to comment.