microsoft / microsoft/durabletask-mssql

Azure Durable Isolated Function - PurgeAllInstancesAsync

Open
#224 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P1
Dominant language
C#
Stars
105
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Calling DurableTaskClient.PurgeAllInstancesAsync throws Grpc.Core.RpcException.

We wanted to have a seamless purge all experience between Azure Storage & SQL Durable Providers.

We do not want to use DurableTaskClient.Purgexxx for AzureStorage & write a SQL store proc call (PurgeInstanceStateByTime) for SQL provider.

LOGS:
[2024-05-30T21:05:52.187Z] Function 'PurgeDurableFunctionsHistory', Invocation id '181eb69c-f632-426d-9a7e-cef38b335400': An exception was thrown by the invocation.
[2024-05-30T21:05:52.189Z] Result: Function 'PurgeDurableFunctionsHistory', Invocation id '181eb69c-f632-426d-9a7e-cef38b335400': An exception was thrown by the invocation.
Exception: Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="Exception was thrown by handler.")
[2024-05-30T21:05:52.190Z] at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.PurgeInstancesCoreAsync(PurgeInstancesRequest request, CancellationToken cancellation)
[2024-05-30T21:05:52.194Z] at FirstIsoFuncApp.Function1.PurgeDurableFunctionsHistoryAsync(TimerInfo myTimer, DurableTaskClient client, CancellationToken cancellationToken) in C:\code\FirstIsoFuncApp\Function1.cs:line 122
[2024-05-30T21:05:52.196Z] at FirstIsoFuncApp.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\code\FirstIsoFuncApp\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 51
[2024-05-30T21:05:52.197Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-05-30T21:05:52.198Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89
Stack: at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.PurgeInstancesCoreAsync(PurgeInstancesRequest request, CancellationToken cancellation)
[2024-05-30T21:05:52.199Z] at FirstIsoFuncApp.Function1.PurgeDurableFunctionsHistoryAsync(TimerInfo myTimer, DurableTaskClient client, CancellationToken cancellationToken) in C:\code\FirstIsoFuncApp\Function1.cs:line 122
[2024-05-30T21:05:52.200Z] at FirstIsoFuncApp.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\code\FirstIsoFuncApp\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 51
[2024-05-30T21:05:52.201Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-05-30T21:05:52.202Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89.
[2024-05-30T21:05:52.227Z] Executed 'Functions.PurgeDurableFunctionsHistory' (Failed, Id=181eb69c-f632-426d-9a7e-cef38b335400, Duration=238ms)
[2024-05-30T21:05:52.229Z] System.Private.CoreLib: Exception while executing function: Functions.PurgeDurableFunctionsHistory. System.Private.CoreLib: Result: Failure
Exception: Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="Exception was thrown by handler.")
[2024-05-30T21:05:52.229Z] at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.PurgeInstancesCoreAsync(PurgeInstancesRequest request, CancellationToken cancellation)
[2024-05-30T21:05:52.230Z] at FirstIsoFuncApp.Function1.PurgeDurableFunctionsHistoryAsync(TimerInfo myTimer, DurableTaskClient client, CancellationToken cancellationToken) in C:\code\FirstIsoFuncApp\Function1.cs:line 122
[2024-05-30T21:05:52.231Z] at FirstIsoFuncApp.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\code\FirstIsoFuncApp\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 51
[2024-05-30T21:05:52.232Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-05-30T21:05:52.233Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89
[2024-05-30T21:05:52.234Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
Stack: at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.PurgeInstancesCoreAsync(PurgeInstancesRequest request, CancellationToken cancellation)
[2024-05-30T21:05:52.235Z] at FirstIsoFuncApp.Function1.PurgeDurableFunctionsHistoryAsync(TimerInfo myTimer, DurableTaskClient client, CancellationToken cancellationToken) in C:\code\FirstIsoFuncApp\Function1.cs:line 122
[2024-05-30T21:05:52.240Z] at FirstIsoFuncApp.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\code\FirstIsoFuncApp\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 51
[2024-05-30T21:05:52.242Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-05-30T21:05:52.243Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89
[2024-05-30T21:05:52.245Z] at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the PurgeAllInstancesAsync call reported at Function1.cs:122 and trace Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.PurgeInstancesCoreAsync through the SQL provider. Compare the SQL and Azure Storage purge behavior and reproduce the Grpc.Core.RpcException; done means PurgeAllInstancesAsync works consistently without a provider-specific SQL procedure workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, grpc, sql
Domain
backend, databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.