aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Download state is incorrect after abort

Open skjernaa opened this issue 4 years ago • 5 comments

Describe the bug

When a download is aborted, the state of the download object should be Canceled. But currently it changes to Failed shortly after the call to abort()

The bug was introduced with the fix to https://github.com/aws/aws-sdk-java/issues/2263

Expected Behavior

download.getState() should keep returning Canceled

Current Behavior

download.getState() starts returning Failed shortly after the call to abort()

Steps to Reproduce

TransferManager transferManager = ...; Download download = transferManager.download(bucketName, objectKey, file); Thread.sleep(1000); download.abort(); assertEquals(TransferState.Canceled, download.getState()); // Typically passes Thread.sleep(100); assertEquals(TransferState.Canceled, download.getState()); // Fails. The state is now Failed

Possible Solution

Bug is in CompleteMultipartDownload.cleanupAfterException (or the caller of this method), where InterruptedException should not mark the download as failed (or more generally: the download should not be set to failed, if the state is already canceled)

Your Environment

aws-java-sdk-s3-1.12.28.jar

skjernaa avatar Sep 28 '21 10:09 skjernaa

Hi @skjernaa , I was able to reproduce the issue. The versions that I tested the above issue with are: JAVA SDK: 1.12.28 and 1.11.749 Java Version: 11

You also mentioned that the issue was introduced with #2263 but investigating further with Java SDK: 1.11.749 which is before the mentioned fix was released, the issue still persists.

Can you please share the version of Java SDK that you are using which did not return download.getState() as Failed and a sample code for the same? This would really help me assist you further and know the root cause of this issue.

Thanks, Anish.

aaoswal avatar Oct 22 '21 23:10 aaoswal

It looks like this issue has not been active for more than five days. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please add a comment to prevent automatic closure, or if the issue is already closed please feel free to reopen it.

github-actions[bot] avatar Oct 28 '21 00:10 github-actions[bot]

Hi @aaoswal

I upgraded from 1.11.638. On that version the test from "Steps to Reproduce" always passes. When I debugged on 1.12.28 I could see that the state was set to Failed by the code introduced in CompleteMultipartDownload (as far as I could see it was changed as part of #2263).

skjernaa avatar Oct 28 '21 08:10 skjernaa

Hi @skjernaa, I am not able to reproduce the issue on SDK Version 1.11.638. Can you please provide me with some additional information below for reproducing the issue to further assist you:

  1. How are the files being uploaded to the S3 buckets?
  2. What is the size of the file that you are uploading?
  3. Any additional customizations that you are using for uploading or in the code?

aaoswal avatar Nov 01 '21 21:11 aaoswal

Hi @aaoswal

Just to clarify: The issue is with downloading. In my environment, on 1.11.638 the test always passes and on 1.12.28 the test always fails.

The file I download is a ~18 MB binary file.

I have attached my full, self contained test (replaced bucket name and key).

TransferManagerTest.java.txt

skjernaa avatar Nov 04 '21 14:11 skjernaa