-
Notifications
You must be signed in to change notification settings - Fork 859
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
S3AsyncClient#getObject
could complete successfully with no file written to disk
#5732
Comments
Just to clarify: when you say "manually deleting the file" you mean deleting the file from the destination path? |
That is correct. |
@aymkhalil we are going to look into why no exception was thrown in this case. Do you have control over the separate process that is deleting the file? Can you tell us more about why the delete is happening? |
We do, that was a race condition that is now fixed: as part of our download failure recovery, we perform a file delete ourselves. In one scenario, we identified a race condition that would trigger the delete from a previous failed download attempt while the newer attempt is progressing. But this raised question about the reliability of success/failure handling we have today: we wanted guarantees that when a download future completes, either a file is on disk, or the future completes exceptionally so we can "reliably" access the file or recover from failure (assuming all bugs are fixed, like the race condition mentioned above). Having said that, I noticed the same behavior (that is, successfully completed future, but no file on disk) reproduced differently: On that last note, I'm curious what would you recommend to reliably cancel a long running download and retry it (in hope that cancel + retry would finish faster that an unexpectedly long running download), I could think of two ways:
Sorry to piggyback on this issue, but although the two scenarios are different, the undesired final state looks exactly the same so they are "related" in that sense. |
Describe the bug
A call to
client.getObject(request, destinationPath)
could complete successfully with no file written to disk. We've seen this in production and was able to write a minimal repro by starting a download, and then manually deleting the file while its being downloaded (for reproduction purposes only, but think a race condition in the business logic) and we could see the future completes successfully.Regression Issue
Expected Behavior
If no file was written to disk, I'd expect the download future to complete exceptionally - either when the external event that deleted the file occurred, or at least when the download operation completes - at this point it should be able to verify if a file was written to disk or not.
Current Behavior
The future will complete successfully although no file is written to disk. An application would typically assume if the future completed without exceptions, then the download was successful and a file was written to disk.
Reproduction Steps
Here is a self contained repo that basically
1\ uploads a 1 GB to
2\ downloads the uploaded file to
/tmp/download/1gb.bin
3\ 5 seconds after the download starts (at this point, the file is being written to disk) delete the file
4\ few seconds later, the future would complete without and exception
async-s3-get-object.zip
To run:
You should see the follow log
Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
2.29.21
JDK version used
java version "17.0.3.1" 2022-04-22 LTS
Operating System and version
macOS 14.0
The text was updated successfully, but these errors were encountered: