{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/721","repository_url":"https://api.github.com/repos/aws/aws-sdk-java-v2","labels_url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/721/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/721/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/721/events","html_url":"https://github.com/aws/aws-sdk-java-v2/issues/721","id":362911323,"node_id":"MDU6SXNzdWUzNjI5MTEzMjM=","number":721,"title":"S3 async downloads complete but file 0 bytes","user":{"login":"ben-manes","id":378614,"node_id":"MDQ6VXNlcjM3ODYxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/378614?v=4","gravatar_id":"","url":"https://api.github.com/users/ben-manes","html_url":"https://github.com/ben-manes","followers_url":"https://api.github.com/users/ben-manes/followers","following_url":"https://api.github.com/users/ben-manes/following{/other_user}","gists_url":"https://api.github.com/users/ben-manes/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-manes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-manes/subscriptions","organizations_url":"https://api.github.com/users/ben-manes/orgs","repos_url":"https://api.github.com/users/ben-manes/repos","events_url":"https://api.github.com/users/ben-manes/events{/privacy}","received_events_url":"https://api.github.com/users/ben-manes/received_events","type":"User","site_admin":false},"labels":[{"id":636336329,"node_id":"MDU6TGFiZWw2MzYzMzYzMjk=","url":"https://api.github.com/repos/aws/aws-sdk-java-v2/labels/Bug","name":"Bug","color":"b60205","default":false},{"id":636336644,"node_id":"MDU6TGFiZWw2MzYzMzY2NDQ=","url":"https://api.github.com/repos/aws/aws-sdk-java-v2/labels/Investigating","name":"Investigating","color":"bfd4f2","default":false},{"id":954565969,"node_id":"MDU6TGFiZWw5NTQ1NjU5Njk=","url":"https://api.github.com/repos/aws/aws-sdk-java-v2/labels/Netty%20NIO%20Client","name":"Netty NIO Client","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-09-23T03:57:01Z","updated_at":"2018-11-14T23:43:32Z","closed_at":null,"author_association":"NONE","body":"After upgrading to the new sdk, I am observing the download future completes prior to the file appearing. In the following code, the assertion fails sporadically. The file does exist on S3, so it appears to be a race condition in the client.\r\n\r\n```java\r\npublic Path download(Path directory, String key) {\r\n  var request = GetObjectRequest.builder().bucket(bucket).key(normalizeKey(key)).build();\r\n  Stopwatch stopwatch = Stopwatch.createStarted();\r\n  try {\r\n    Path destination = directory.resolve(request.key());\r\n    Files.createDirectories(destination.getParent());\r\n    s3.getObject(request, toFile(destination)).join();\r\n    checkState(Files.exists(destination) && Files.size(destination) > 0L,\r\n        \"Failed to download from S3: %s\", request.key());\r\n\r\n    logger.info(\"Completed S3 download of {} in {}\", request.key(), stopwatch);\r\n    return destination;\r\n  } catch (Exception e) {\r\n    throw new RuntimeException(\"Failed to download from S3: \" + request.key(), e);\r\n  }\r\n}\r\n```\r\n\r\n```\r\njava.lang.IllegalStateException: Failed to download from S3: c8dbae15-807a-48e1-8a4a-4fb4418bee73/component/image/1537382453460/7521bcaa-dc86-49f3-b248-989e21851cfc/page2.txt\r\n\tat com.google.common.base.Preconditions.checkState(Preconditions.java:588)\r\n```"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/comments/438860847","html_url":"https://github.com/aws/aws-sdk-java-v2/issues/721#issuecomment-438860847","issue_url":"https://api.github.com/repos/aws/aws-sdk-java-v2/issues/721","id":438860847,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODg2MDg0Nw==","user":{"login":"varunnvs92","id":17261531,"node_id":"MDQ6VXNlcjE3MjYxNTMx","avatar_url":"https://avatars0.githubusercontent.com/u/17261531?v=4","gravatar_id":"","url":"https://api.github.com/users/varunnvs92","html_url":"https://github.com/varunnvs92","followers_url":"https://api.github.com/users/varunnvs92/followers","following_url":"https://api.github.com/users/varunnvs92/following{/other_user}","gists_url":"https://api.github.com/users/varunnvs92/gists{/gist_id}","starred_url":"https://api.github.com/users/varunnvs92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varunnvs92/subscriptions","organizations_url":"https://api.github.com/users/varunnvs92/orgs","repos_url":"https://api.github.com/users/varunnvs92/repos","events_url":"https://api.github.com/users/varunnvs92/events{/privacy}","received_events_url":"https://api.github.com/users/varunnvs92/received_events","type":"User","site_admin":false},"created_at":"2018-11-14T23:43:32Z","updated_at":"2018-11-14T23:43:32Z","author_association":"CONTRIBUTOR","body":"I believe both issues have been fixed in the latest release `2.0.0-preview-13`. I was able to repo the incomplete file download issue on preview-11 but not on preview-13. We had multiple refactoring around the async code which likely fixed both issues.\r\n\r\nCan you try with the latest version and verify the behavior. If you are still seeing the issues, please provide a repo code. Thank you for the opening the issue with detailed reports. I will leave the ticket open awaiting your verification."}}
{"actor":{"display_login":"varunnvs92"}}