-
Notifications
You must be signed in to change notification settings - Fork 15
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
Client waits during connecting #25
Comments
I did some experimentation and unless I missed something (which is very possible, of course) to me this really seems like a programming error: In an async framework waiting for the connection on the calling thread clearly violates the "we do non-blocking io" promise. The fix seems pretty straight-forward: instead of waiting for the channel, just return the future. I am not sure why the |
The motivation for returning the Channel was incase any other consumers needed access to the channel but it makes sense for it to be a future in the non-blocking case. My only concern is making this change in a non-breaking way or making it as part of the next major version (which will be Swift 5/NIO 2). What version of Swift do you need this for? |
Yes this for sure is a breaking change unfortunately. However, I think it is probably ok to do it even for Swift4/NIO1. As it stands today this This being said, if you do the change (see here), smoke-aws and smoke-credentials will build just fine, because they don’t use the So, my advice would be: fix it in smoke-http with a major version bump and upgrade the dependency in other packages (I don’t know if this would be minor or bugfix for those). If this plan is not feasible, I’m also happy to maintain my fork for the time being. For now I’m stuck with NIO1 and Swift4. Alternatively you could also introduce a new |
SmokeFramework has a slightly different threading model to Vapor. By default, SmokeFramework only uses NIO event loop threads for actual IO, executing operation handlers on the global DispatchQueue[1]. We chose this default partially for this reason - NIO threads aren't really general purpose and have restrictions on what you can and cannot do on them (calling wait for example). Calling out into unknown (from the framework's perspective) application code is probably best handled on a general DispatchQueue, at least as a default. And so we have services using SmokeFramework happily running in production without running into this issue. That said, it is definitely a bug that you cannot call into |
A fix for this issue was committed to master in #37. This has now been released as 2.0.0. Resolving this issue. Let us know if there are any further issues. |
Nice! Thank you! |
Cross-posted: amzn/smoke-aws#18
I am using
DynamoDBClient
from inside a Vapor app.Inside a route I call
AWSDynamoDBClient.queryAsync(input:completion:)
this will eventually call
HTTPClient.executeAsync<A>()
in there we have:
this raises a fatal error:
Probably in a method called
Async
you should never.wait()
... ?The text was updated successfully, but these errors were encountered: