azure-sdk-for-net: Upload blob async frozen when using memory stream, no error
I’m experiencing a problem with Azure.Storage.Blobs 12.4.0 No error, just frozen forever when trying to upload a stream (an in-memory json string) using Azurite.
It seems the server receives the attempt, but does nothing and the API does not throw any error either:
sqlserver_1 | 172.18.0.1 - - [24/Mar/2020:01:38:55 +0000] "PUT /devstoreaccount1/landing/test637206559996473201.json?st=2020-03-23T13%3A57%3A00Z&se=2020-03-25T13%3A57%3A37Z&sp=racwdl&sv=2018-03-28&sr=c&sig=RYDvl1aQeEIY3isg17LGGtx63Krum13gTXgn981cOco%3D HTTP/1.1" - -
Azurite is running, I can access with the Azure Blob Storage Explorer and generate a sas token uri pasted below.
My code:
var fileName = $"test{DateTime.UtcNow.Ticks}.json";
var fileStream = new MemoryStream();
fileStream.Write(Encoding.UTF8.GetBytes("{'foo': 'bar'}"));
var blobContainerClient = new BlobContainerClient("http://127.0.0.1:10000/devstoreaccount1/landing?st=2020-03-23T13%3A57%3A00Z&se=2020-03-25T13%3A57%3A37Z&sp=racwdl&sv=2018-03-28&sr=c&sig=RYDvl1aQeEIY3isg17LGGtx63Krum13gTXgn981cOco%3D");
await blobContainerClient.UploadBlobAsync(fileName, fileStream); //this gets stuck, no error, just frozen there
PS: The Azurite I use for the test is:
version: '3'
services:
sqlserver:
image: mcr.microsoft.com/azure-storage/azurite
restart: always
ports:
- 10000:10000
- 10001:10001
# Run
# docker-compose -f azurite.yml up -d
Can anybody spot what the issue might be?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (18 by maintainers)
I was also having this issue. I found that I had to reset the position to 0 to get this to work.
Seems like a bug, when the stream position is not reset the expected behavior should be uploading an empty blob, not hanging.