dotnet / dotnet/orleans

AzureBlobLeaseProvider throwing exeception with default configuration

Open
#8,375 0 comments 0 reactions 0 assignees View on GitHub
Needs: triage :mag:
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
14h 42m
Merged PRs (30d)
354

Description

Using the AzureBlobLeaseProvider using DefaultBlobContainerName causes an exception during startup:

> Autofac.Core.DependencyResolutionException
> HResult=0x80131500
> Message=An exception was thrown while activating λ:Microsoft.Extensions.Hosting.IHostedService[] -> Orleans.Hosting.SiloHostedService.
> Source=Autofac
> […]
> This exception was originally thrown at this call stack:
> Orleans.Streaming.AzureStorage.AzureBlobUtils.ValidateContainerName(string) in AzureBlobUtils.cs
> Orleans.Configuration.AzureBlobLeaseProviderOptionsValidator.ValidateConfiguration() in AzureBlobLeaseProviderOptions.cs
>
> Inner Exception 1:
> DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Orleans.Runtime.Silo, System.Collections.Generic.IEnumerable`1[Orleans.IConfigurationValidator], Microsoft.Extensions.Logging.ILogger`1[Orleans.Hosting.SiloHostedService])' on type 'SiloHostedService'.
>
> Inner Exception 2:
> OrleansConfigurationException: Configuration for AzureBlobLeaseProviderOptions is invalid. BlobContainerName is not valid
>
> Inner Exception 3:
> ArgumentException: Invalid container name Arg_ParamName_Name

From what I found the problem is the default defined for the container name in AzureBlobLeaseProviderOptions:
```csharp
public const string DefaultBlobContainerName = "Leases";
```
does not match the regular expression used when validating the container name using AzureBlobUtils:
```csharp
[GeneratedRegex("^[a-z0-9]+(-[a-z0-9]+)*$", RegexOptions.ExplicitCapture | RegexOptions.Singleline | RegexOptions.CultureInvariant)]
```
This fails due to the leading upper case ‘L’ in ‘Leases’.

The workaround is to set BlobContainerName to an all-lowercase value.

Contributor guide

Open the contributing guide

Research direction

Start with AzureBlobLeaseProviderOptions and AzureBlobUtils.ValidateContainerName, then compare the default BlobContainerName with the validator's allowed format. Done means the default configuration passes validation and AzureBlobLeaseProvider no longer throws during startup; confirm this through the existing startup or configuration validation path mentioned in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cloud
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.