Skip to content

serializer, http, grpc: default inbound size limits to warn-only - #3576

Merged
idelpivnitskiy merged 2 commits into
apple:mainfrom
bryce-anderson:warn-by-default
Jul 20, 2026
Merged

serializer, http, grpc: default inbound size limits to warn-only#3576
idelpivnitskiy merged 2 commits into
apple:mainfrom
bryce-anderson:warn-by-default

Conversation

@bryce-anderson

@bryce-anderson bryce-anderson commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

The inbound message-size limits (gRPC maxInboundMessageSize, HTTP maxAggregatedPayloadSize, and the streaming serializer frame limit) each defaulted to enforcing a 4 MiB cap and rejecting oversized messages. To ease rollout, the built-in default should warn rather than reject, so operators can observe the impact before opting into enforcement.

Modifications

  • Flip the built-in default of each limit to warn-only (-1): an oversized message is delivered but a rate-limited (once per 5 min) warning is logged. This covers MessageSizeLimiter (serializer-utils), HttpConfig (http-netty), and GrpcMessageSizeLimiter (grpc-api).
  • Enforcement stays opt-in: a positive value via the builder enforces (0 disables), and the temporary system property still accepts a positive value, 0, or -1. The property now seeds the warn-only default, so only log the "temporary property" notice when it is actually set.
  • Leave the public javadoc and website docs describing the enforcing 4 MiB default (the intended steady state); the temporary warn-only behavior will be called out in release notes rather than the API docs, since warn-only is transient.

Result

Out of the box, an oversized inbound message is logged (rate-limited) rather than rejected. Enforcement remains one builder call (or system property) away.

Behavior change

Reverses the 4 MiB default from enforcing to warn-only.

 #### Motivation

The inbound message-size limits (gRPC maxInboundMessageSize, HTTP
maxAggregatedPayloadSize, and the streaming serializer frame limit) each defaulted
to enforcing a 4 MiB cap and rejecting oversized messages. To ease rollout, the
built-in default should warn rather than reject, so operators can observe the
impact before opting into enforcement.

 #### Modifications

- Flip the built-in default of each limit to warn-only (-1): an oversized message
  is delivered but a rate-limited (once per 5 min) warning is logged. This covers
  MessageSizeLimiter (serializer-utils), HttpConfig (http-netty), and
  GrpcMessageSizeLimiter (grpc-api).
- Enforcement stays opt-in: a positive value via the builder enforces (0 disables),
  and the temporary system property still accepts a positive value, 0, or -1. The
  property now seeds the warn-only default, so only log the "temporary property"
  notice when it is actually set.
- Update the javadoc, website docs, and tests.

 #### Result

Out of the box, an oversized inbound message is logged (rate-limited) rather than
rejected. Enforcement remains one builder call (or system property) away.

 #### Behavior change

Reverses the 4 MiB default from enforcing to warn-only. Deployments relying on the
default to reject oversized messages must now enforce explicitly via
maxInboundMessageSize(int) / maxAggregatedPayloadSize(int) (or the temporary system
property).
/**
* Singleton instance which creates <a href="https://developers.google.com/protocol-buffers/">protocol buffer</a>
* serializers, applying the default maximum streaming message size.
* serializers; its streaming deserializers warn (rate-limited), rather than rejecting, when a message exceeds the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Javadoc is part of public API. If users read it once, they unlikely to re-read it. That's the main reason why for a long time we tried to avoid clarifying default values in javadoc, as we could change some.

As the warn-only will be a temporary behavior, we shouldn't rewrite all our docs to say that it's a default behavior. We should either keep docs as they were and only mark in release notes that temporarily we enabling warn-only mode, or we can enhance javadoc for each case to say that warn-only mode is temporary and will change to enforcement soon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reverted the javadoc change.

@idelpivnitskiy
idelpivnitskiy merged commit e59e0f9 into apple:main Jul 20, 2026
19 checks passed
@bryce-anderson
bryce-anderson deleted the warn-by-default branch July 20, 2026 21:58
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.

2 participants