Closed marius-se closed 1 year ago
Did you provide the AWSClient
with a shared HTTPClient
or EventLoopGroup
. If not I imagine this is something to do with the default EventLoopGroup
used by macOS.
HTTPClientProvider.createNew
HTTPClient
will be created byAWSClient
. Whenshutdown
is called, createdHTTPClient
will be shut down as well.
Ok this is probably an issue with the default EventLoopGroup on macOS which is NIOTSEventLoopGroup
from swift-nio-transport-services. If you want to chase this then I would add a bug to AsyncHTTPClient.
This isn't really something that can be fixed in Soto.
Okay I'll definitely try to investigate! However I have no clue about SwiftNIO/ AsyncHTTPClient so I'll probably forward this bug in a few days. Thanks anyways!
Hmm I couldn't reproduce this behaviour with a plain async-http-client. Trying to fire a request after calling HTTPClient.shutdown()
throws HTTPClientError.alreadyShutdown
. Here is the (async-http-client) code:
import AsyncHTTPClient
@main
struct Main {
static func main() async throws {
let httpClient = HTTPClient(eventLoopGroupProvider: .createNew)
try await httpClient.shutdown()
let request = HTTPClientRequest(url: "https://apple.com/")
let response = try await httpClient.execute(request, timeout: .seconds(30)) // throws HTTPClientError.alreadyShutdown
}
}
In Soto however calling S3.signURL(url:httpMethod:expires:)
after AWSClient.shutdown()
does not throw an error. (where S3
uses an AWSClient
created with HTTPClientProvider.createNew
). See the sample project above.
signURL
doesn't use the HTTPClient. All it does is generate a URL so that isn't really a like for like test
Ohhh that makes sense. But still, shouldn't AWSClient
complain if we try to access it after calling shutdown
, even if it's just signURL
? What do you think?
I guess I could add a check into the signURL and signHeaders calls. I'm not sure it really makes much difference though.
I don't think this is an issue so am going to close it
oh sorry, yep can be closed!
Describe the bug On macOS the AWSClient is still working after I called the
syncShutdown
method. Compiling the exact same code on Ubuntu results in the "expected" behaviour: AWS requests not working anymore since the client shut down.To Reproduce I noticed this behaviour while working with S3.
docker build . -t sotobug
&&docker run sotobug
)On macOS the request will still succeed, on ubuntu it will not return at all.
Expected behavior On both operating systems the request should not succeed and maybe even throw an error.
Setup (please complete the following information):