Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Usage of CreateAsync() method triggering 409(container already exist) errors resulting unresponsive application #39

@preuday

Description

@preuday

Hello Team,

When using the following application "https://github.com/microsoft/Partner-Center-Storefront", noticed container "customerportalassets" being called multiple times and multiple 409(container already exists) errors received on create container operation resulting in an unresponsive application.

From the below code section ,noticed CreateAsync() method

///


/// Returns a cloud BLOB container reference which can be used to manage the public customer portal assets.
///

/// The public customer portal assets BLOB container.
public async Task GetPublicCustomerPortalAssetsBlobContainerAsync()
{
if (publicBlobContainer == null)
{
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
publicBlobContainer = blobClient.GetContainerReference(PublicPortalAssetsBlobContainerName);
}

        if (!await publicBlobContainer.ExistsAsync().ConfigureAwait(false))
        {
            await publicBlobContainer.CreateAsync().ConfigureAwait(false);

            BlobContainerPermissions permissions = await publicBlobContainer.GetPermissionsAsync().ConfigureAwait(false);
            permissions.PublicAccess = BlobContainerPublicAccessType.Blob;

            await publicBlobContainer.SetPermissionsAsync(permissions).ConfigureAwait(false);
        }

        return publicBlobContainer;
    }

As per following document this method will throw error when container already exists. Reference doc : https://docs.microsoft.com/bs-latn-ba/Azure/storage/blobs/storage-blob-container-create?tabs=dotnetv11#create-a-container

 The CreateIfNotExists and CreateIfNotExistsAsync methods return a Boolean value indicating whether the container was created. If a container with the same name already exists, these methods return False to indicate a new container wasn't created. 

could you please confirm if this createAsync() method here could be causing the 409s on container "customerportalassets" , If
not , please share your insights or workaround to avoid these errors from Application end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions