-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Storage] Progress callback called incorrectly from BlockBlobClient.uploadFile #4719
Comments
Digging into this more, it seems to be specific to let fileStream = fs.createReadStream("testfile.txt");
await blockBlobClient.uploadStream(fileStream, 64000, 2, {
//await blockBlobClient.uploadFile("testfile.txt", {
progress: (p) => console.log(`Uploaded ${p.loadedBytes} bytes`)
}); This sort of makes sense since |
@mjrousos You can customize |
Even with the default settings, though, the callback is called many times before any data has actually uploaded, which is misleading. With a block size of 256MB I would expect that the progress callback shouldn't be called until 256MB (or the entire file if it's smaller than that) has uploaded. |
When uploading happens block by block, then progress only updates per block uploads succesfully. When uploading happens in a single PUT Blob request (for size less than maxSingleShotSize), progress will update when reading the stream. |
I see what you mean about this being a single-block PUT, but it still seems like reporting progress while reading the stream (instead of after the block has been uploaded) is confusing. It seems like the progress callback is used differently in this case than in other cases (like |
The progress update callback is scheduled in underline @azure/core-http implemention. @HarshaNalluru do you know who can help improve this? |
|
We just pass the parameter of type |
@jeremymeng Progress update for single request is scheduled in core-http. |
@XiaoningLiu Got it. So the issue only happens when uploading files with size < 256 MB. I see the option being passed in |
It's likely that we reported befoer the data is actually pushed. https://github.com/Azure/azure-sdk-for-js/blob/feature/storage/sdk/core/core-http/lib/fetchHttpClient.ts#L91 |
Yes. |
We were reporting the progress before data is pushed. This leads to customer reported issue like Azure#4719 This change introduce a `ReportStream` that provides the correct `_transform` behavior.
We were reporting the progress before data is pushed. This leads to customer reported issue like Azure#4719 This change introduce a `ReportStream` that provides the correct `_transform` behavior.
We were reporting the progress before data is pushed. This leads to customer reported issue like Azure#4719 where the uploaded progress events are triggered before data chunks are completely uploaded. This change introduces a `ReportStream` that provides the correct `_transform` behavior.
We were reporting the progress before data is pushed. This leads to customer reported issue like Azure#4719 where the uploaded progress events are triggered before data chunks are completely uploaded. This change introduces a `ReportStream` that provides the correct `_transform` behavior.
We were reporting the progress before data is pushed. This leads to customer reported issue like #4719 where the uploaded progress events are triggered before data chunks are completely uploaded. This change introduces a `ReportStream` that provides the correct `_transform` behavior.
A fix is made in core-http. We need to upgrade to depend on the next core-http preview version. |
core-http preview.4 merged into feature/storage branch we updated to the new version |
Is this also an issue for uploadData method? I have been noticing similar problem. Progress returns a 100% whereas the file is not uploaded to blob yet. |
@faraazhabeeb123 do you have a simple project that demonstrate the problem? That would greatly help us to determine whether it's a new issue or not. |
Describe the bug
If a progress callback is provided in
UploadStreamToBlockBlobOptions
when callingBlockBlobClient.uploadFile
, the progress callback is quickly called for all the chunks of the file (before they have actually uploaded). The upload then continues (without progress) until it's done.This is different from the .NET SDK which calls the progress callback only when bytes are actually uploaded, as expected.
This gif shows progress callbacks called while uploading a ~10MB file using the .NET SDK. Notice that the callbacks happen over the course of the upload, as expected:
Compare that to this gif showing the same file being uploaded using the JS SDK. Notice that the progress callback is called a lot all at the beginning and then the file uploads (without any progress notifications):
To Reproduce
Upload a large file using this pattern:
For comparison, here is a .NET Core C# repro that works as expected:
MyProgressHandler
is defined as:Expected behavior
I would expect the progress callback to only be called when bytes are actually uploaded to Azure over the course of the upload operation.
The text was updated successfully, but these errors were encountered: