-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
POST throws timeout error, even though it gets response #1215
Comments
Hm, that does seem pretty confusing! Is it with those small bodies, or have they been clipped for this report? Do you set a timeout on the client builder? |
Thanks for the quick response @seanmonstar ! Yep, it's always the same small body,
|
The timeout does seem to be getting hit though - the "200 OK" line shows up exactly 30 seconds before the outer ERROR logline that indicates the error bubbling up:
One thing worth noting - I'm making a bunch of JSON RPC requests in sequence (synchronously) against the IPs 172.23.0.6, 8, 10, 12, and 14, but it doesn't always fail on the same one. E.g. in this stacktrace that I took just now, it was node 172.23.0.14, whereas in the stacktrace above is was 172.23.0.12. |
Huh, so what returns the actual timeout error? I'm guessing in your code you've received the |
This is the full match statement:
AFAICT it's the actual |
One other thing - I hit a very similar issue with |
Yep, just confirmed with extra debugging @seanmonstar - it's the outermost
arm that's getting hit; the error is getting thrown by this piece of code:
It's not even making it to the body-reading |
Hm, you mention tonic... are you using this in an async context? I mean, if you were, I'd expect you'd have hit the debug_assert trying to catch that, but if it didn't trigger, it's really easy for that mixture to cause a deadlock... |
I'll have to beg some ignorance here as I'm a bit of a Rust newb - I have |
And actually, this reminds me that using |
Yes it does (you had to make it |
Will give that a go! Question though - what's actually happening, that causes this behaviour? It seems like in both the |
And actually a followon question: I control the |
@seanmonstar I switched to using the async client and it sometimes works, but now I'm seeing exactly the same behaviour as in hyperium/tonic#575 - the request gets received, but then
That minute-and-a-half gap between 09:22 and 10:59 seems to be a perpetual hang inside
|
Hm, when I read through the tonic issue, I notice a bunch more
Do you mean how a blocking API (like |
Ohh that's super fascinating - Re. what's actually happening - thanks for the explanation; that's actually really helpful for understanding! And presumably, this is implementation-dependent - i.e. this deadlock only happens in an async context, and in a synchronous context parking the thread works fine. |
Nope, since Rust async usually multiplexes many individual futures on a single thread. An executor usually polls all until not ready, registers in some thing that can keep track cheaply (like epoll), and then waits on said thing to know when any of the those futures are ready again. If the thread is parked, it can't do that.
The
|
Ahhh that makes way more sense now! So I tried switching to |
Just tried to remove the
I did a bunch of reading and think I understand |
Tower itself doesn't really need Tokio. If you're using Tonic, there isn't a good way to make it all blocking. Especially if you're making a server, it's probably easiest/best to just make it all async. Otherwise, you usually need a new thread per request. |
Ah sorry, this is actually for a client (which is why multithreading is way less important). That's the bit that has me sorta confused - why I need an async runtime at all for a client that's really just executing a bunch of sequential calls to the server. (The server is already written/tested, in Go) |
Just found the |
Closing the loop here, for posterity - the problem was indeed what @seanmonstar said. Having |
I'm seeing something that has me very confused. I'm making this request:
The server receives the request, and replies as seen in the server logs:
This response gets registered in the client's logs for the request:
and yet, that code returns an
Err
:How can this be?
The text was updated successfully, but these errors were encountered: