azure-functions-host
azure-functions-host copied to clipboard
Add retries for BlobStorageSecretsRepository precondition failures (concurrency scenarios)
Our blob storage persistence code can fail with 412 Precondition errors if two separate updates are racing to add keys to the same file. For example if two concurrent requests are made to add/modify host keys, one update will succeed the other will fail. This is due to the precondition code here which ensures that no intervening updates happen when writing the blob. Same issue likely exists for the file based provider, but we should focus on blob since it's the default.
We should consider putting retries in place for this, so the host will re-read the current state of the blob as updated by another request, and use the new Etag, allowing the update to succeed. Perhaps we do up to three retries.