Upload blob async frozen when using memory stream, no error
See original GitHub issueI’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?
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (18 by maintainers)
Top Results From Across the Web
Why does BlobClient.UploadAsync hang when uploading ...
I'm trying to upload JSON to an Azure blob via a memory stream. When I call UploadAsync my application hangs. If I move...
Read more >Will not upload to Azure blob storage
This is how I try to upload to Azure. Now I try to upload then there will be no error at all. Thus...
Read more >Azure Blob Storage on Iot Edge module stops upload ...
We are currently experiencing an issue with the Azure Blob Storage on IoT Edge module. The module is configured to automatically upload files...
Read more >Dos and Don'ts for Streaming File Uploads to Azure Blob ...
Implement file uploads the wrong way, and you may end up with memory leaks, server slowdowns, out-of-memory errors, and worst of all, unhappy...
Read more >Using Async, Await, and Task to keep the WinForms UI ...
Using the async/await pattern in WinForms is an easy win, helping prevent one of the most annoying user experiences - a frozen UI....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.