Azure Storage Blob v12.10.0 - "Azure.RequestFailedException: The condition specified using HTTP conditional header(s) is not met." exception while trying to download blobs.
See original GitHub issueWe currently use Azure Storage Blob v12.10.0 which we recently migrated to. And now, we are transiently hitting Azure.RequestFailedExceptions while trying to download blobs.
Code:
try
{
StorageTransferOptions options = new StorageTransferOptions
{
// Set the maximum number of workers that
// may be used in a parallel transfer.
MaximumConcurrency = this.parallelOperationThreadCount
};
await blob.DownloadToAsync(stream, new BlobRequestConditions(), options, cancellationToken).ConfigureAwait(false);
tracer.Succeeded = true;
}
catch (Exception e)
{
this.eventLogger.LogWarning($"Failed to download with exception:{e}");
throw;
}
Error Detials:
Azure.RequestFailedException: The condition specified using HTTP conditional header(s) is not met. RequestId:ab1be42c-501e-0007-740d-5cc588000000 Time:2022-04-29T21:07:00.1407329Z Status: 412 (The condition specified using HTTP conditional header(s) is not met.) ErrorCode: ConditionNotMet Content: <?xml version="1.0" encoding="utf-8"?><Error>ConditionNotMet
<Message>The condition specified using HTTP conditional header(s) is not met. RequestId:ab1be42c-501e-0007-740d-5cc588000000 Time:2022-04-29T21:07:00.1407329Z</Message></Error> Headers: x-ms-request-id: ab1be42c-501e-0007-740d-5cc588000000 x-ms-client-request-id: eae8ba9d-fe6f-4c4e-8526-2233250ce9c3 x-ms-version: 2020-10-02 x-ms-error-code: ConditionNotMet Date: Fri, 29 Apr 2022 21:06:59 GMT Server: Windows-Azure-Blob/1.0,Microsoft-HTTPAPI/2.0 Content-Length: 252 Content-Type: application/xml at Azure.Storage.Blobs.BlobRestClient.
Questions:
Note: We are currently not adding any Request Conditions but still throws the conditional header(s) is not met error.
- Found this solution while browsing for a fix: link. Would you recommend this fix for Azure Storage Blob v12.10.0 as well?
- If we make ifMatch=*, what is the effect on DownloadToAsync operation? And in the scenario where we are updating while trying to download the same blob, what is the effect on both the operations?
Issue Analytics
- State:
- Created a year ago
- Comments:18 (1 by maintainers)
Top GitHub Comments
Fixed this by setting IfMatch = ETag.All as part of BlobRequestConditions. This is an optimistic approach as per the link. The assumption here is that, setting a property field such as IfMatch does not affect the blob contents and does not interrupt DownloadToAsync operation. Also, according to this link, a blob either does not exist or exist with the entire content that was put including metadata.
Code Changes:
Hello @anandnara We have routed this issue to the Service Team’s attention for further action, thanks for the detailed information!