Skip to content

Commit 6605a73

Browse files
Merge pull request #11455 from rabbitmq/default-max-message-size
Reduce default maximum message size to 16MB
2 parents 1723798 + c11b812 commit 6605a73

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

deps/amqp10_client/test/system_SUITE.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,20 @@ stop_amqp10_client_app(Config) ->
105105
init_per_group(rabbitmq, Config0) ->
106106
Config = rabbit_ct_helpers:set_config(Config0,
107107
{sasl, {plain, <<"guest">>, <<"guest">>}}),
108-
rabbit_ct_helpers:run_steps(Config, rabbit_ct_broker_helpers:setup_steps());
108+
Config1 = rabbit_ct_helpers:merge_app_env(Config,
109+
[{rabbit,
110+
[{max_message_size, 134217728}]}]),
111+
rabbit_ct_helpers:run_steps(Config1, rabbit_ct_broker_helpers:setup_steps());
112+
109113
init_per_group(rabbitmq_strict, Config0) ->
110114
Config = rabbit_ct_helpers:set_config(Config0,
111115
{sasl, {plain, <<"guest">>, <<"guest">>}}),
112116
Config1 = rabbit_ct_helpers:merge_app_env(Config,
113117
[{rabbit,
114-
[{amqp1_0_default_user, none}]}]),
118+
[{amqp1_0_default_user, none},
119+
{max_message_size, 134217728}]}]),
115120
rabbit_ct_helpers:run_steps(Config1, rabbit_ct_broker_helpers:setup_steps());
121+
116122
init_per_group(activemq, Config0) ->
117123
Config = rabbit_ct_helpers:set_config(Config0, {sasl, anon}),
118124
rabbit_ct_helpers:run_steps(Config,

deps/rabbit/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ _APP_ENV = """[
129129
{default_consumer_prefetch, {false, 0}},
130130
%% interval at which the channel can perform periodic actions
131131
{channel_tick_interval, 60000},
132-
%% Default max message size is 128 MB
133-
{max_message_size, 134217728},
132+
%% Default max message size is 16 MB
133+
{max_message_size, 16777216},
134134
%% Socket writer will run GC every 1 GB of outgoing data
135135
{writer_gc_threshold, 1000000000},
136136
%% interval at which connection/channel tracking executes post operations

deps/rabbit/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ define PROJECT_ENV
112112
{default_consumer_prefetch, {false, 0}},
113113
%% interval at which the channel can perform periodic actions
114114
{channel_tick_interval, 60000},
115-
%% Default max message size is 128 MB
116-
{max_message_size, 134217728},
115+
%% Default max message size is 16 MB
116+
{max_message_size, 16777216},
117117
%% Socket writer will run GC every 1 GB of outgoing data
118118
{writer_gc_threshold, 1000000000},
119119
%% interval at which connection/channel tracking executes post operations

deps/rabbit/test/message_size_limit_SUITE.erl

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@
1414

1515
all() ->
1616
[
17-
{group, tests}
17+
{group, tests},
18+
{group, default}
1819
].
1920

2021
groups() ->
2122
[
2223
{tests, [], [
2324
max_message_size
24-
]}
25+
]},
26+
{default, [], [
27+
default_max_message_size
28+
]}
2529
].
2630

2731
suite() ->
@@ -70,9 +74,6 @@ max_message_size(Config) ->
7074
Binary6M = gen_binary_mb(6),
7175
Binary10M = gen_binary_mb(10),
7276

73-
Size2Mb = 1024 * 1024 * 2,
74-
Size2Mb = byte_size(Binary2M),
75-
7677
ok = rabbit_ct_broker_helpers:rpc(Config, persistent_term, put, [max_message_size, 1024 * 1024 * 3]),
7778

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

108+
default_max_message_size(Config) ->
109+
Binary15M = gen_binary_mb(15),
110+
Binary17M = gen_binary_mb(20),
111+
112+
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
113+
114+
%% Binary is within the default max size limit of 16MB
115+
amqp_channel:call(Ch, #'basic.publish'{routing_key = <<"none">>}, #amqp_msg{payload = Binary15M}),
116+
%% The channel process is alive
117+
assert_channel_alive(Ch),
118+
119+
Monitor = monitor(process, Ch),
120+
amqp_channel:call(Ch, #'basic.publish'{routing_key = <<"none">>}, #amqp_msg{payload = Binary17M}),
121+
assert_channel_fail_max_size(Ch, Monitor).
122+
107123
%% -------------------------------------------------------------------
108124
%% Implementation
109125
%% -------------------------------------------------------------------

0 commit comments

Comments
 (0)