Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1378 #1380

Merged
merged 5 commits into from
Sep 1, 2023
Merged

Fix #1378 #1380

merged 5 commits into from
Sep 1, 2023

Conversation

MarcialRosales
Copy link
Contributor

@MarcialRosales MarcialRosales commented Sep 1, 2023

  • Fix issue Configured MaxMessageSize is not honoured  #1378
  • Updated ConnectionFactory.DefaultMaxMessageSize to today's RabbitMQ max message size.
  • Updated the APIApproval's verified file because of the MaxMessageSize changed in ConnectionFactory.cs.

Note: I replaced the received file with the verified one. According to the docs, that seems to be the correct thing to do.

  • Bumped up the time to wait to receive a message in one of the test cases that ensure we cannot modify the message's payload after we sent it. In GH workflow, the test case always passed. But when running it from Concourse, things take longer to run and therefore 2sec was not enough.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

michaelklishin
michaelklishin previously approved these changes Sep 1, 2023
@michaelklishin michaelklishin merged commit b6f9437 into main Sep 1, 2023
@michaelklishin michaelklishin deleted the fix-1378 branch September 1, 2023 19:56
@@ -109,7 +109,7 @@ public sealed class ConnectionFactory : ConnectionFactoryBase, IConnectionFactor
/// Corresponds to the <code>rabbit.max_message_size</code> setting.
/// Note: the default is 0 which means "unlimited".
/// </summary>
public const uint DefaultMaxMessageSize = 134217728;
public const uint DefaultMaxMessageSize = 536870912;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments state the the default value is 0, i.e. unlimited. Should we enforce this value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should use a limited default as of 6.6.0. It's high enough to likely not affect many.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default max message size for RabbitMQ main (i.e. 3.13) is the following...

C:\Users\lbakken\development\rabbitmq\rabbitmq-server [rabbitmq-server-9258 ≡]
> git grep max_message_size
deps/rabbit/BUILD.bazel:138:        {max_message_size, 134217728},
deps/rabbit/Makefile:120:           {max_message_size, 134217728},
deps/rabbit/priv/schema/rabbit.schema:927:{mapping, "max_message_size", "rabbit.max_message_size"

...same with 3.12.x

C:\Users\lbakken\development\rabbitmq\rabbitmq-server_v3.12.x [v3.12.x ≡]
> git grep max_message_size
deps/rabbit/BUILD.bazel:135:        {max_message_size, 134217728},
deps/rabbit/Makefile:118:           {max_message_size, 134217728},
deps/rabbit/priv/schema/rabbit.schema:927:{mapping, "max_message_size", "rabbit.max_message_size",

@MarcialRosales @michaelklishin why did we decide to use 512MiB in this code?

Copy link
Contributor Author

@MarcialRosales MarcialRosales Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukebakken I decided it based on this value https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbit_common/include/rabbit.hrl#L257. and also the docs. The docs suggests a default value and a maximum allowed value of 512Mb. But I can change it. Let me know If I should use 134217728 as maximum message size value or keep 512Mb.

@@ -76,7 +76,7 @@ public AmqpTcpEndpoint(string hostName, int portOrMinusOne, SslOption ssl, uint
HostName = hostName;
_port = portOrMinusOne;
Ssl = ssl;
_maxMessageSize = maxMessageSize;
_maxMessageSize = Math.Min(maxMessageSize, ConnectionFactory.DefaultMaxMessageSize);
Copy link

@dank100 dank100 Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the comment above.
This change is not necessary - If we continue to use 0 as the default value, i.e. unlimited, based on the comment.

@@ -269,5 +269,51 @@ public void TestCreateConnectioUsesValidEndpointWhenMultipleSupplied()
var ep = new AmqpTcpEndpoint("localhost");
using (IConnection conn = cf.CreateConnection(new List<AmqpTcpEndpoint> { invalidEp, ep })) { };
}

[Fact]
public void TestCreateConnectionUsesConfiguredMaxMessageSize()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests, this is exactly what is needed to enforce this variable :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants