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
TransferManager fails on uploading large files (> 2 GB) #374
Comments
Hi, @rsteph-de. Thank you for reporting this. Your logic certainly makes sense, and it uncovered a bug in our tests as well that was preventing us from catching this, so thank you again. I've added this to our backlog and hopefully we can get this in for the next release. |
Is this bug causing you to lose data or to store incorrect data? Or is it simply failing with an error because of some nonsensical negative numbers being used? |
I used
and got the following exception:
Using a debugger I found the faulty line. |
Excellent. Thank you for that. I will keep you posted on progress here |
10.2.0 has been published and contains a fix for this bug. Please let us know if you continue to have issues. |
azure-storage-java/src/main/java/com/microsoft/azure/storage/blob/TransferManager.java
Line 104 in ebdc214
The maximum Integer value 2147483647.
When processing files larger than 2 GB the casting of (file.size() ...) from long to int may lead to negative values, because the value range for integer does not fit.
This results in a negative count value.
Suggested solution:
use Math.min(long, long) and cast the result to int:
int count = (int)Math.min(blockLength, (file.size() - i * blockLength));
The text was updated successfully, but these errors were encountered: