summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Fedotov <hairyhum@gmail.com>2018-12-27 19:26:37 +0400
committerDaniil Fedotov <hairyhum@gmail.com>2018-12-27 19:26:37 +0400
commit03fc22ddd9d0b47fb735f36c4c5421a7baeb2ad9 (patch)
tree36c1b3c141f262ca6eb47bf6e90a3efb2590024c /src
parent794ef8de24ec261d1f3217f0a1ccfae98c8c6873 (diff)
downloadrabbitmq-server-git-03fc22ddd9d0b47fb735f36c4c5421a7baeb2ad9.tar.gz
Introduce a configurable limit to message size.
Add `max_message_size` configuration to configure limit in bytes. If message is bigger - channel exception will be thrown. Default limit is 128MB. There is still a hard limit of 521MB. [#161983593]
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_channel.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index d1f3b06528..f626f059a0 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -990,7 +990,15 @@ check_msg_size(Content) ->
case Size > ?MAX_MSG_SIZE of
true -> precondition_failed("message size ~B larger than max size ~B",
[Size, ?MAX_MSG_SIZE]);
- false -> ok
+ false ->
+ case application:get_env(rabbit, max_message_size) of
+ {ok, MaxSize} when is_integer(MaxSize) andalso Size > MaxSize ->
+ precondition_failed("message size ~B larger than"
+ " configured max size ~B",
+ [Size, MaxSize]);
+
+ _ -> ok
+ end
end.
check_vhost_queue_limit(#resource{name = QueueName}, VHost) ->