Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

CloudBlobContainer.CreateIfNotExists() on existing container causes 409 result #481

Closed
vinniep79 opened this issue Jun 13, 2017 · 4 comments

Comments

@vinniep79
Copy link

Hello, I recently updated from version 7.2.1 to version 8.1.3 and I noticed that when I invoke CloudBlobContainer.CreateIfNotExists() on an existing container, I'm getting a 406 with success=false:

Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.RemoteDependency","time":"2017-06-13T22:59:24.5594728Z","tags":{"ai.internal.nodeName":"XXXXX","ai.operation.parentId":"U9cwDWtLrQQ=","ai.operation.name":"XXX","ai.operation.id":"U9cwDWtLrQQ=","ai.location.ip":"::1","ai.cloud.roleInstance":"XXXXX","ai.internal.sdkVersion":"rddf:2.3.0-1223"},"data":{"baseType":"RemoteDependencyData","baseData":{"ver":2,"name":"XXXXX","duration":"00:00:00.8452021","resultCode":"409","success":false,"type":"Azure blob","target":"XXXXX,"properties":{"DeveloperMode":"true"}}}}

This is causing my ApplicationInsights to blow up with failed dependencies. I looked at pre-upgrade calls and found that these were returning a 200 success code.

If the container already exists, I would expect that this call would not attempt to create it, so a 409 is not necessary.

The try-catch approach here is causing me grief:

https://github.com/Azure/azure-storage-net/blob/master/Lib/ClassLibraryCommon/Blob/CloudBlobContainer.cs#L220

versus the cleaner approach in Exists():

https://github.com/Azure/azure-storage-net/blob/master/Lib/ClassLibraryCommon/Blob/CloudBlobContainer.cs#L1369

@erezvani1529
Copy link
Contributor

Hi @vinniep79,

As documented in the ReadMe file, this behavior is expected and the change has been made as an optimization to avoid the extra head call for cases where the container doesn't exist.

These failures should be ignored as the library handles them internally.

Thanks,
Elham

@mirobers
Copy link
Member

@vinniep79, this behavior is actually more correct. Previously, app insights would report a failure when you successfully create a container. Now it reports failure when the creation does not go through. If a large fraction of your calls to storage are failed container creation attempts then you might consider moving container creation to a one-time initialization step.

@vinniep79
Copy link
Author

Hi @erezvani1529 , @mirobers, thank you for the response. I see the line in the readme file today. I must have completely missed it yesterday. My apologies.

@erezvani1529
Copy link
Contributor

Thanks @vinniep79 for reporting your issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants