Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of entity operation errors for isolated entities #2752

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Fix issue with isolated entities: custom deserialization was not working because IServices was not passed along (https://github.com/Azure/azure-functions-durable-extension/pull/2686)
- Fix issue with `string` activity input having extra quotes (https://github.com/Azure/azure-functions-durable-extension/pull/2708)
- Fix issue with out-of-proc entity operation errors: success/failure details of individual operations in a batch was not processed correctly (https://github.com/Azure/azure-functions-durable-extension/pull/2752)

### Breaking Changes

Expand Down
29 changes: 20 additions & 9 deletions src/WebJobs.Extensions.DurableTask/OutOfProcMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,27 @@ void SetErrorResult(FailureDetails failureDetails)
functionName.Name,
batchRequest.InstanceId,
functionResult.Exception.ToString(),
FunctionType.Orchestrator,
FunctionType.Entity,
isReplay: false);

SetErrorResult(new FailureDetails(
errorType: "FunctionInvocationFailed",
errorMessage: $"Invocation of function '{functionName}' failed with an exception.",
stackTrace: null,
innerFailure: new FailureDetails(functionResult.Exception),
isNonRetriable: true));
if (context.Result != null)
{
// Send the results of the entity batch execution back to the DTFx dispatch pipeline.
// This is important so we can propagate the individual failure details of each failed operation back to the
// calling orchestrator. Also, even though the function execution was reported as a failure,
// it may not be a "total failure", i.e. some of the operations in the batch may have succeeded and updated
// the entity state.
dispatchContext.SetProperty(context.Result);
}
else
{
SetErrorResult(new FailureDetails(
errorType: "FunctionInvocationFailed",
errorMessage: $"Invocation of function '{functionName}' failed with an exception.",
stackTrace: null,
innerFailure: new FailureDetails(functionResult.Exception),
isNonRetriable: true));
}

return;
}
Expand All @@ -399,8 +411,7 @@ void SetErrorResult(FailureDetails failureDetails)
FunctionType.Entity,
isReplay: false);

// Send the result of the orchestrator function to the DTFx dispatch pipeline.
// This allows us to bypass the default, in-process execution and process the given results immediately.
// Send the results of the entity batch execution back to the DTFx dispatch pipeline.
dispatchContext.SetProperty(batchResult);
}

Expand Down
Loading