1

I tried to download a file from an empty blob container, and I got 404 as expected. The question is I see only 1 call for this file in fiddler, instead of 3 (as I specified in the RetryPolicy), also I notice the call finishes within 1 second, so it definitely did not wait for 10 seconds before try it again... How do I know if the BlobClient really did the retry?

var blobClient = this.storageAccount.CreateCloudBlobClient(); blobClient.DefaultRequestOptions.RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(10), 3); var anchorString = await cloudBlobContainer.GetBlockBlobReference(ARGO_ANCHOR_VERSION_FILE).DownloadTextAsync();

Carol
  • 363
  • 5
  • 16

1 Answers1

3

The question is I see only 1 call for this file in fiddler, instead of 3 (as I specified in the RetryPolicy)

This is expected behavior as the default retry policies (Linear, Exponential etc.) don't retry all operations. Retry policies are for handling transient errors. You mentioned that you got 404 (Not Found) error and that is not a retryable operation as it is not a transient error. Usually errors with status code 500+ are retryable by default.

You can however create a custom retry policy and make any error code retryable. I wrote a blog post long time back on retry polcies and there I wrote some code for creating a custom retry policy. You can create a custom retry policy that treats 404 error as a tranient error and then you should see storage client library retrying your operation. You can read that post here: http://gauravmantri.com/2012/12/30/storage-client-library-2-0-implementing-retry-policies/.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • 1
    Thanks for the explanation! It is confusing as I saw the StorageException.IsRetryable = true for this exception though – Carol Jul 15 '16 at 02:09
  • 1
    Do take a look at the code here: https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/StorageException.cs. Based on this `IsRetryable` is only set false in case of an `ArgumentException` (e.g. you provide an invalid blob container name). HTH. – Gaurav Mantri Jul 15 '16 at 02:58