Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.48k stars 4.81k forks source link

[QUERY] Correct handling of error ConditionNotMet #35632

Open klesta490 opened 1 year ago

klesta490 commented 1 year ago

Library name and version

Azure.Storage.Blobs 12.13.1.0

Query/Question

We are using BlockBlobClient.OpenWriteMethod(true) to stream uploads directly to blob storage. In rare scenarios these upload fails with 412 Conditon Not Met. (like 1 in X milions of requests). The blob is not updated concurrently, only BlockBlobStream returned from OpenWriteMethod writes to blob from single thread.

I have setup storage diagnostic and the findings are for all cases very similiar. In diagnostic there is 1) PutBlob that creates empty blob with response 201 2) PutBlock that stages data with response 201 3) Successfull request to PutBlockList that commmits block ids and changes ETAG - unfortunatelly this 201 response does not reach client and client detect this as retryable error, propably some network issue. 4) Client tries to retry PutBlockList, because he is not sure how 3) ended. But because client have outdated ETAG, this retry fails on 412 ConditonNotMet.

There are two 412 status codes, because first 412 is from manually called BlockBlobStream.Flush (we call it manually in our code) and second one is from BlockBlobStream.Dispose.

MicrosoftTeams-image (14)

Is there anything I can do to avoid this? Because in most cases I have found, data are OK in blob storage, but we have to return error from our upload API.

Environment

No response

github-actions[bot] commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

github-actions[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

PramodValavala-MSFT commented 1 year ago

@klesta490 Thanks for the feedback! Considering the intermittent nature of this issue, we are routing this to the concerning team to better assist here.

klesta490 commented 1 year ago

Any update?