Skip to content

Oversized activity and entity completions are abandoned and re-executed indefinitely #848

Backlog

Description

@andystaples

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: PrepareOrchestratorResponseAsync replaces responses over MaxInlineOrchestratorResponseSizeInBytes (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.
  • ExecuteWithRetryAsync doesn't retry ResourceExhausted, so the exception reaches RunBackgroundTask's catch, which logs it and calls AbandonTaskActivityWorkItemAsync / 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 example ActivityResponseTooLarge), so the orchestration receives TaskFailed and 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions