[BUG] UploadAsync with BlobRequestConditions fails criteria if providing a RetriableStreamImpl
See original GitHub issueDescribe the bug
Demonstration @ https://github.com/seankearney/azure-storage-sdk-tag-conditions-bug
When a blob is downloaded from storage and then that Stream (Azure.Core.Pipeline.RetriableStream.RetriableStreamImpl
) is provided to a subsequent Upload call, the upload will fail if there are BlobRequestConditions
.
We’ve discovered a work around where if we copy the Azure.Core.Pipeline.RetriableStream.RetriableStreamImpl
to a MemoryStream
it will work as expected.
Expected behavior
In this scenario, where we don’t have an existing blob, I would expect to be able to have the blob created given a Stream
from a previous DownloadAsync
call.
Actual behavior (include Exception or Stack Trace)
Azure.RequestFailedException : The condition specified using HTTP conditional header(s) is not met.
...
Status: 412 (The condition specified using HTTP conditional header(s) is not met.)
ErrorCode: ConditionNotMet
To Reproduce
See provided tests @ https://github.com/seankearney/azure-storage-sdk-tag-conditions-bug
- Download a blob from storage
- Use that resulting stream as the content of a new blob. As part of the upload, provide
BlobUploadOptions
that contains aBlobRequestConditions
- You should notice that the blob fails to meet the conditions and isn’t persisted
Found Work Around
If the RetryableStreamImpl
is copied to a MemoryStream
the conditions are satisfied and the blob is persisted.
Environment:
- Visual Studio 16.9.4
- Azure.Storage.Blobs 12.8.3
.NET SDK (reflecting any global.json):
Version: 5.0.202
Commit: db7cc87d51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.202\
Host (useful for support):
Version: 5.0.5
Commit: 2f740adc14
.NET SDKs installed:
5.0.202 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:17 (12 by maintainers)
Top GitHub Comments
Sorry I should have been more specific. In order to do a one shot upload the InitialTransferSize and MaximumTransferSize should be equal to or more than the size of the blob. Or else the blob will be uploaded in multiple blocks and this error will occur.
@amnguye any updates?