Skip to content

Allow overriding HTTP/2 maxFrameSize via system property / env var#49417

Merged
jeet1995 merged 6 commits into
Azure:mainfrom
jeet1995:jeet1995/http2-max-frame-size-override
Jun 8, 2026
Merged

Allow overriding HTTP/2 maxFrameSize via system property / env var#49417
jeet1995 merged 6 commits into
Azure:mainfrom
jeet1995:jeet1995/http2-max-frame-size-override

Conversation

@jeet1995

@jeet1995 jeet1995 commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #49397

Exposes the HTTP/2 SETTINGS_MAX_FRAME_SIZE advertised by ReactorNettyClient as a customer-tunable setting. Previously the value was hard-coded to 64 KB; this threads it through Configs so users can grow the frame size for Gateway HTTP/2.

Config

  • System property: COSMOS.HTTP2_MAX_FRAME_SIZE_IN_KB
  • Environment variable: COSMOS_HTTP2_MAX_FRAME_SIZE_IN_KB
  • Unit: KB
  • Default: 64 KB
  • Range: clamped to [64, 16383] KB
  • Bad input handling: unparseable values fall back to the 64 KB default; out-of-range values are clamped.

Changes

  • Adds Configs.getHttp2MaxFrameSizeInBytes() with property/env resolution and validation.
  • Uses the new config in ReactorNettyClient HTTP/2 settings.
  • Adds ConfigsTests.http2MaxFrameSizeInBytes coverage for default, valid values, clamping, and parse fallback.

jeet1995 and others added 2 commits June 8, 2026 16:22
Adds COSMOS.HTTP2_MAX_FRAME_SIZE_IN_KB system property and COSMOS_HTTP2_MAX_FRAME_SIZE_IN_KB environment variable to override the HTTP/2 SETTINGS_MAX_FRAME_SIZE advertised by ReactorNettyClient. Value is expressed in KB and clamped to [64 KB, 16 MB]; unparseable values fall back to the 64 KB default. Adds unit tests for default, valid override, lower/upper clamp, and unparseable fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use 16383 KB as the customer-facing upper bound so the converted byte value remains below the HTTP/2 SETTINGS_MAX_FRAME_SIZE spec maximum of 2^24 - 1 bytes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Cosmos label Jun 8, 2026
jeet1995 and others added 2 commits June 8, 2026 16:44
Use the local http2CfgAccessor helper when applying effective HTTP/2 max concurrent streams settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jeet1995 jeet1995 marked this pull request as ready for review June 8, 2026 20:51
@jeet1995 jeet1995 requested review from a team and kirankumarkolli as code owners June 8, 2026 20:51
Copilot AI review requested due to automatic review settings June 8, 2026 20:51

@FabianMeiswinkel FabianMeiswinkel left a comment

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.

LGTM - Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the HTTP/2 SETTINGS_MAX_FRAME_SIZE that the Cosmos ReactorNettyClient advertises configurable via system property or environment variable, instead of being hard-coded. This fits into the Cosmos gateway HTTP/2 transport configuration surface by allowing customers to tune frame size (e.g., for Gateway HTTP/2 scenarios) while keeping a safe default and enforcing bounds.

Changes:

  • Added Configs.getHttp2MaxFrameSizeInBytes() to resolve COSMOS.HTTP2_MAX_FRAME_SIZE_IN_KB / COSMOS_HTTP2_MAX_FRAME_SIZE_IN_KB, validate, clamp to [64, 16383] KB, and convert to bytes.
  • Wired the new config into ReactorNettyClient HTTP/2 settings via .maxFrameSize(...).
  • Added unit tests covering default, valid bounds, clamping behavior, and parse-fallback.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java Replaces the hard-coded HTTP/2 max frame size with the new Configs-driven value.
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Configs.java Introduces the new max-frame-size configuration, including precedence, validation, clamping, and byte conversion.
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ConfigsTests.java Adds unit coverage for the new configuration behavior.

@tvaron3 tvaron3 left a comment

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.

LGTM

Rename CosmosGlobalSecondaryIndexDefinition.getDefinition to getQueryDefinition so the method name matches the documented query definition purpose.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@FabianMeiswinkel FabianMeiswinkel left a comment

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.

LGTM - Thanks!

Restore CosmosGlobalSecondaryIndexDefinition.getDefinition and related test references.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@FabianMeiswinkel FabianMeiswinkel left a comment

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.

LGTM

@FabianMeiswinkel

Copy link
Copy Markdown
Member

/check-enforcer override

@jeet1995 jeet1995 enabled auto-merge (squash) June 8, 2026 22:14
@jeet1995 jeet1995 merged commit 987c15b into Azure:main Jun 8, 2026
15 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[COSMOS] HTTP/2 maxFrameSize hardcoded to 64KB causes Http2Exception + IllegalReferenceCountException with Cosmos Gateway responses

5 participants