Azure / durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
Apache License 2.0
1.47k stars 287 forks source link

Error in AppLeaseStarter task, when running Durable Function and Azurite in docker container using docker compose. #1010

Open JohanKlijn opened 7 months ago

JohanKlijn commented 7 months ago

When running Azure Durable Function in a docker container and using Azurite as storage account/provider an exception occurs in the DurableTask.AzureStorage.Partitioning.AppLeaseManager.

Environment

The connection string used by the Durable Function is using the "default developers connection string" and pointing to the host "". Full connnection string:

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://host.docker.internal:9990/devstoreaccount1;QueueEndpoint=http://host.docker.internal:9991/devstoreaccount1;TableEndpoint=http://host.docker.internal:9992/devstoreaccount1;

Steps to reproduce I created a repo which allows you to easily reproduce the issue. Perform the following steps to reproduce the issue:

  1. Clone the repo https://github.com/JohanKlijn/AzDurableFunctionsOnContainersSample
  2. Run the following command in the root of the repo
    docker build . -f "docker\Dockerfile" -t azfunctiononcontainer
  3. Start the container by running the following command from the directory .\docker
    docker compose up

When the containers are running the first error will be:

docker-azfunctiononcontainer-1  | fail: DurableTask.AzureStorage[122]
docker-azfunctiononcontainer-1  |       mytaskhub-applease: Error in AppLeaseStarter task. Exception: DurableTask.AzureStorage.Storage.DurableTaskStorageException: The specified blob does not exist.
docker-azfunctiononcontainer-1  |        ---> Microsoft.WindowsAzure.Storage.StorageException: The specified blob does not exist.
docker-azfunctiononcontainer-1  |          at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
docker-azfunctiononcontainer-1  |          at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress`1 progressHandler, CancellationToken cancellationToken)
docker-azfunctiononcontainer-1  |          at DurableTask.AzureStorage.Storage.AzureStorageClient.WrapFunctionWithReturnType(Func`3 storageRequest, OperationContext context, CancellationToken cancellationToken) in /_/src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 157
docker-azfunctiononcontainer-1  |          at DurableTask.AzureStorage.TimeoutHandler.ExecuteWithTimeout[T](String operationName, String account, AzureStorageOrchestrationServiceSettings settings, Func`3 operation, AzureStorageOrchestrationServiceStats stats, String clientRequestId)
docker-azfunctiononcontainer-1  |          at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func`3 storageRequest, String accountName, String operationName, String clientRequestId, Boolean force)

after the first error the following error keeps occurring:

docker-azfunctiononcontainer-1  | fail: DurableTask.AzureStorage[122]
docker-azfunctiononcontainer-1  |       mytaskhub-applease: Error in AppLeaseStarter task. Exception: System.InvalidOperationException: AppLeaseManager has already started
docker-azfunctiononcontainer-1  |          at DurableTask.AzureStorage.Partitioning.AppLeaseManager.StartAppLeaseAsync() in /_/src/DurableTask.AzureStorage/Partitioning/AppLeaseManager.cs:line 250
docker-azfunctiononcontainer-1  |          at DurableTask.AzureStorage.Partitioning.AppLeaseManager.AppLeaseManagerStarter(CancellationToken cancellationToken) in /_/src/DurableTask.AzureStorage/Partitioning/AppLeaseManager.cs:line 146

Full log file is attachted to this issue. Log running Durable Function and Azurite in docker.txt

JohanKlijn commented 6 months ago

Anyone?