Azure / AppConfiguration-DotnetProvider

The .NET Standard configuration provider for Azure App Configuration
https://github.com/Azure/AppConfiguration
MIT License
77 stars 34 forks source link

Using of AzureAppConfigurationRefreshMiddleware breaks durable function orchestration #484

Open ivankaurov opened 8 months ago

ivankaurov commented 8 months ago

Code of AzureAppConfigurationRefreshMiddleware includes the following line

await next(context).ConfigureAwait(false);

This line breaks the execution of Durable Orchestrator by leaving it in running state even after the execution is completed succesfully. It means that Microsoft.Azure.AppConfiguration.Functions.Worker package and especially AzureAppConfigurationRefreshExtensions.UseAzureAppConfiguration can't be used with Durable out-of-process Azure functions.

This can refer to the constraint that Orchestrators can't use .ConfigureAwait(false) in there code.

jimmyca15 commented 8 months ago

@ivankaurov

It sounds then that our library needs to know if it's running on a platform that doesn't support ConfigureAwait. Up until this point the adopted practice has been always use ConfigureAwait. My initial thinking is that we'll need to figure out a way to detect that our library is running in this environment and have some helper to decide whether to configure await or not.

Thank you for reporting !

@amerjusupovic

cgillum commented 7 months ago

/cc @jviau

jviau commented 7 months ago

I don't believe there is anything for AppConfiguration team to do here. The issue lies entirely on the durable side, we are imposing a constraint on the rest of the functions middleware pipeline - which frankly is not a good design on our end. There is an issue I opened to provide an extensibility point to for durable to avoid the issue: https://github.com/Azure/azure-functions-dotnet-worker/issues/1666