Reduce default maximum message size to 16MB

This commit is contained in:
Diana Parra Corbacho 2024-06-14 09:18:46 +02:00
parent 0f00374c58
commit c11b812ef6
4 changed files with 33 additions and 11 deletions

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -14,14 +14,18 @@
all() ->
[
{group, tests}
{group, tests},
{group, default}
].
groups() ->
[
{tests, [], [
max_message_size
]}
]},
{default, [], [
default_max_message_size
]}
].
suite() ->
@ -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),
@ -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
%% -------------------------------------------------------------------