Closed ghost closed 1 year ago
Regarding the issue you linked to, that is resolved in NIO v2.44. This is an issue in the HTTP parser NIO use. NIO have implemented a workaround because the HTTP parser fix hasn't been implemented.
Are you running a HEAD request before the getObject
call? If you are the NIO fix might not cover every instance. Add the AWSLoggingMiddleware()
to the AWSClient
or S3
object to log every request sent to AWS.
let s3 = S3(client: awsClient ...).with(middlewares: [AWSLoggingMiddleware()])
You can then verify if any HEAD requests are being sent to AWS.
Does this only occur with large files? If so you could use multipartUpload
instead. You can upload the file in 16 separate parts if smaller uploads work. For an 80mb file you should really be using multipartUpload
anyway.
Hi @adam-fowler; thank you for the response.
Got some logs, but seems like there is no HEAD
request.
Logs for getObject
:
Request:
GetObject
GET https://bucket-name.us-east-1.amazonaws.com/path/file.zip?x-id=GetObject
Headers: [
user-agent : Soto/6.0
]
Body: empty
stream ended at an unexpected time - stream ended at an unexpected time
Does this only occur with large files?
Not 100% sure; the issue occurs once in 5-10 attempts. And primarily for large files; at least, I didn't catch one with a small size (if not counting the next part).
If so you could use
multipartUpload
instead.
I assume you mean multipartDownload
. Tried to use it instead but got the same error on a 2nd try. Here're the logs:
Hi sorry, I haven't got back to you earlier.
I believe this is most likely an issue with either AsyncHTTPClient or SwiftNIO. I can't be sure though. I'm going to ask for more info again though to see if I can narrow it down a little further. Can you do the GetObject call with a Logger that is set to output trace logs eg
var logger = Logger(label: "test")
logger.logLevel = .trace
let request = S3.GetObjectRequest(...)
try s3.getObject(request, logger: logger).wait()
And then post the results here
Hi @adam-fowler, no problem. Sure, I'll try to do it and get back to you, but it might take some time. Also, one note, we've enabled "Transfer Acceleration" in the bucket, and I didn't experience an issue since that. It is probably still here, but I'd assume that it mostly happened at a slow speed.
When you say you've enabled transfer acceleration have you also added the option to the Soto S3 type to use it.
Yes, we did
Hello, tried to reproduce an issue for the last 3 hours with no luck.
Same setup as before, with no code changes and no transfer acceleration, but all works as expected now.
I'll close an issue; it seems like it has nothing to do with soto
.
But feel free to reopen and ping me if I can help by providing anything in addition.
Out of context, thank you for a great library!
Describe the bug We're getting "stream ended at an unexpected time" from
swift-nio
when runninggetObject
. Happens sometimes, and mostly with big files (>80MB).I've seen this issue in NIO, I assume it is related, but it still happens for me on the latest version.
soto
- 6.2.0,swift-nio
- 2.44.0.Is there any workaround that we can use to avoid this until it is fixed?
To Reproduce Steps to reproduce the behavior:
getObject
.Expected behavior "stream ended at an unexpected time" doesn't appear.
Setup (please complete the following information):