Skip to content

Default DTS gRPC sends to a configurable 4 MiB limit - #847

Closed
Bernd Verst (berndverst) wants to merge 1 commit into
mainfrom
berndverst-dts-grpc-limits
Closed

Bernd Verst (berndverst) wants to merge 1 commit into
mainfrom
berndverst-dts-grpc-limits

Conversation

@berndverst

Copy link
Copy Markdown
Member

Summary

What changed?

  • Default DTS .NET client and worker channels to a 4 MiB outbound limit per serialized gRPC message. Set MaxSendMessageSize to a positive byte count to override it or null to disable the SDK cap.
  • Apply the limit to initial and recreated channels, and include it in the channel cache keys. Leave receive limits, history chunking, and the existing 3.9 MiB inline orchestrator completion check unchanged.

Why is this change needed?

  • Match the standard DTS receive limit so oversized messages fail locally with ResourceExhausted instead of being sent and then rejected by DTS.

Issues / work items

  • N/A

Project checklist

  • Release notes are not required for the next release
    • Otherwise: Notes added to release_notes.md
  • Backport is not required
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • All required tests have been added/updated (unit tests, E2E tests)
  • Breaking change?
    • If yes:
      • Impact: No breaking change for standard DTS traffic: requests accepted by DTS are still accepted. Oversized messages fail at the SDK rather than the server.
      • Migration guidance: If an endpoint is configured to accept larger messages, set a matching MaxSendMessageSize or use null to restore uncapped SDK sends.

AI-assisted code disclosure (required)

Was an AI tool used? (select one)

  • No
  • Yes, AI helped write parts of this PR (e.g., GitHub Copilot)
  • Yes, an AI agent generated most of this PR

If AI was used:

  • Tool(s): GitHub Copilot
  • AI-assisted areas/files: DTS client and worker options and channel factories, loopback gRPC tests, and README guidance.
  • What you changed after AI output: No manual code edits observed. The default and the ability to disable it were user-directed.

AI verification (required if AI was used):

  • I understand the code and can explain it
  • I verified referenced APIs/types exist and are correct
  • I reviewed edge cases/failure paths (timeouts, retries, cancellation, exceptions)
  • I reviewed concurrency/async behavior
  • I checked for unintended breaking or behavior changes

Testing

Automated tests

  • Result: Passed (12 tests). dotnet test .\test\Grpc.IntegrationTests\Grpc.IntegrationTests.csproj --no-restore --filter 'FullyQualifiedName~DtsGrpcSendLimitTests|FullyQualifiedName~ClientDeadlineTests|FullyQualifiedName~LegacyChunkSize_DoesNotLimitInlineResponses' --verbosity quiet --logger 'console;verbosity=normal'

Manual validation (only if runtime/behavior changed)

  • Environment (OS, .NET version, components): Windows, .NET 10, loopback ASP.NET Core gRPC service.
  • Steps + observed results:
    1. No separate manual run against managed DTS; the automated loopback tests exercise both DTS channel factories.
    2. A message of exactly 4 MiB reaches the service; a message one byte larger fails locally even though the service would accept it.
    3. A 5 MiB override and null both allow messages over the default; the channel cache respects the updated setting.
  • Evidence (optional): DtsGrpcSendLimitTests.

Notes for reviewers

  • This is a per-message SDK limit, not a per-stream limit. Raising or disabling it does not change what DTS accepts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 21:11

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.

🟡 Changes recommended

The documentation incorrectly extends the 3.9 MiB orchestrator-response check to all work-item completions and does not clarify that only null disables the MaxSendMessageSize cap.

2 open issues
What changed in this PR

Adds a configurable outbound gRPC message limit to Durable Task Scheduler clients and workers, matching DTS’s standard 4 MiB receive limit so oversized messages fail locally.

Changes:

  • Defaults sends to 4 MiB per serialized message, with positive overrides or null for uncapped sends.
  • Applies the setting when creating channels and includes it in channel cache keys.
  • Adds loopback tests and configuration guidance while leaving receive limits and history chunking unchanged.
File Description
test/​Grpc.IntegrationTests/​DtsGrpcSendLimitTests.cs Tests size boundaries, overrides, validation, and cache behavior.
src/​Worker/​AzureManaged/​DurableTaskSchedulerWorkerOptions.cs Adds and applies the worker send-limit option.
src/​Worker/​AzureManaged/​DurableTaskSchedulerWorkerExtensions.cs Includes the send limit in worker channel cache keys.
src/​Shared/​AzureManaged/​GrpcMessageSizeDefaults.cs Defines the shared 4 MiB default.
src/​Client/​AzureManaged/​DurableTaskSchedulerClientOptions.cs Adds and applies the client send-limit option.
src/​Client/​AzureManaged/​DurableTaskSchedulerClientExtensions.cs Includes the send limit in client channel cache keys.
README.md Documents the default limit and configuration choices.

Review effort: Balanced

Comment thread README.md
Comment on lines +217 to +218
does not change the scheduler's limits, including the 3.9 MiB limit for work-item
completion requests.
/// Gets or sets the maximum size, in bytes, of each outgoing gRPC message. Defaults to 4 MiB (4,194,304 bytes).
/// </summary>
/// <remarks>
/// Set to a positive value or <see langword="null"/> to disable the SDK send limit.
@berndverst

Copy link
Copy Markdown
Member Author

We have to decided to let the server enforce the message size limit to allow future flexibility. Abandoning this PR.

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