Repository navigation
Description
Problem
When an activity result or entity batch result exceeds the Durable Task Scheduler's gRPC receive limit (4 MiB by default), the service rejects CompleteActivityTaskAsync / CompleteEntityTaskAsync with ResourceExhausted ("Received message exceeds the maximum configured message size."). The worker abandons the work item, the service redelivers it, and the activity or entity operations re-execute indefinitely. The calling orchestration stays Running with no failure surfaced.
With Microsoft.DurableTask.*.AzureManaged 1.28.0 against the DTS emulator, an activity returning 5 MiB re-executed 14 times in 75 seconds (redelivery delay growing from about 0.3 s to about 18 s), and the orchestration never left Running. The same rejection applies to entity batches, including batches whose individual results are small but whose combined EntityBatchResult exceeds 4 MiB.
Cause
In src/Worker/Grpc/GrpcDurableTaskWorker.Processor.cs:
- Orchestration responses are bounded:
PrepareOrchestratorResponseAsyncreplaces responses overMaxInlineOrchestratorResponseSizeInBytes(about 3.9 MiB) with a non-retriable failed completion, so oversized orchestration outputs fail cleanly. - Activity completions (
OnRunActivityAsync→CompleteActivityTaskAsync) and entity completions (OnRunEntityBatchAsync→CompleteEntityTaskAsync) have no equivalent check. ExecuteWithRetryAsyncdoesn't retryResourceExhausted, so the exception reachesRunBackgroundTask's catch, which logs it and callsAbandonTaskActivityWorkItemAsync/AbandonTaskEntityWorkItemAsync. The service then redelivers the same work item.
The Azure Blob payload interceptor only converts permanent payload-storage failures into non-retriable activity failures (#691); without that extension there is no protection.
Proposed behavior
Apply the same treatment orchestration responses already get:
- After payload externalization, check activity and entity completions against the inline bound.
- Replace an oversized activity completion with a non-retriable
FailureDetails(for exampleActivityResponseTooLarge), so the orchestration receivesTaskFailedand the activity isn't re-run. - Replace an oversized entity batch completion with a batch failure that omits partial state and results, so the pending calls fail and the entity state is unchanged.
An orchestration should not be left stuck indefinitely because one of its activity or entity completions can never be accepted.
Related
- Fail oversized activity and entity completions instead of abandoning and re-executing them durabletask-go#202 tracks the same behavior in the Go SDK.
- Default DTS gRPC sends to a configurable 4 MiB limit #847 (closed) chose to let the server enforce message-size limits rather than setting a client send limit; this issue is about handling the server's rejection without an abandon loop.
Activity