-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download file from Azure Blob Storage hangs when retrieving final 1-2 blocks #729
Comments
I wanted to add this as a separate comment rather than detract from the original, but I did notice this very odd bit of behavior. If I throw an error immediately after the file download, it looks like the file download completes in a reasonable amount of time:
This logs to the console:
Note the timestamps --- there is very little delay between retrieving all of the blocks. The whole download completes in ~36ms. Of course, throwing an error does me no good as it fails my function execution. Swallowing the error in a try/catch just reproduces the original behavior |
What version of Could you share the files you're using to test? I'm curious if there's anything weird/unique about them. I used the command |
Hi @ejizba, We're using @azure/storage-blob Here is a sample ~2mb file that I am having trouble downloading |
Also confirming I tried |
The sample file worked fine for me 🤷♂️. Maybe it's something unique about your storage account? You could try a fresh new storage account if you think that could be contributing |
@ejizba sorry for bothering you with this. I determined the root cause was in our function app code. After downloading from blob storage, we had a bit of poorly performing code that was taking a long time to operate on the downloaded blob. It looked like the blob was never finished downloading because I couldn't log the progress to 100%, but it appears that has something to do with using |
No problem, glad you got it figured out! There's some known issues around the timing/ordering of |
Investigative information
Please provide the following:
Note: I am providing a particular instance where this failed, but this is 100% reproducible for me and my team members when running the FunctionApp locally.
Repro steps
BlockBlobClient
using package@azure/storage-blob
downloadToBuffer()
on the blockBlobClient and store it to a variableExpected behavior
Actual behavior
Known workarounds
Does not hang on smaller file sizes. Tried with 16kb and 32kb without issue. No luck on file sizes greater than about 1.3mb
Related information
I realize this is smelling like a bug in blob storage, however the reason I am filing it here is that this behavior is only reproducible when downloading the blob from the function host. I have tried downloading the blob in a few ways:
blockSize
shead
request to get the file content length, followed by a series of httpget
byte range requests to retrieve the blob in chunks (again using a SAS URL)In each case, the blob download completes in around 1 second from a simple NodeJS script. However they all seem to hang when downloading from a function host. In cases 1, 2, and 4 I was able to write progress to my console (using
context.log
) and could see consistently that I would actually retrieve the whole file except the last 1 or 2 chunks of data, at which point it would hang.For a 1.3MB file, it would hang for 3.5 minutes before actually completing successfully. For a 2.1MB file, the hang was longer than my 5 minute function timeout, so I did not see if it would complete successfully since my function would timeout before it could.
@azure/functions
:^4.1.0
programming modelSample output given the download attempted using the code from Source below:
Source
Download file:host.json:
The text was updated successfully, but these errors were encountered: