-
-
Notifications
You must be signed in to change notification settings - Fork 858
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
Connect Timeout confusion #832
Comments
Interesting, thanks!
Questions:
My two hypotheses so far are: a) These monitoring backends have limited support for asyncio, or… Would you be able to share:
|
Hi @florimondmanca ! Thanks for the response. I must add that, right now, after removing the newrelic dependency I no longer seeing the
Not expected :/ Right now what I'm seeing is this: and
and
|
For reference, I have this HTTPX Wrapper class that I use:
|
One more observation: when disabling the HTTP/2 in a client, the number of connect timeouts are a lot higher to a specific host then when enabled. When enabled I have almost no timeouts, but have the errors described above. |
Idea: maybe I'm hitting #634 and the the underlying connection can't be acquired because close in hanging? I know this specific host is made in DotNet Core 2.2, which (as being Microsoft) could result in the same effect as the linked issue? |
More news: creating the client with |
@victoraugustolls that approach of the wrapper seems nice, could you share what you are doing on the call file? |
@freis sure:
|
@florimondmanca a new error has appeared 😢
|
Yeah I got something similar using trio also |
@florimondmanca I made a sample project to help find the issue! |
Added an update with an endpoints for |
@victoraugustolls Are you using the latest HTTPX release? Several issues you mentioned (ProtocolError, ConnectionCloses, etc) remind me of past issues that should have been resolved in bug fix releases. Are you still experiencing the spurious connect timeouts? Also FYI — the HTTPService code looks okay. Though I see you’re still using a tracing library — are you sure the library correctly supports async execution? |
Yes! 0.11.1
Yes I am, randomly
I tried without without any tracing and it had no effects. In the sample repository I removed all tracing, just basic client usage, and I can simulate the random Also, the Other observation is that, if in my application I have the same client for my HTTPServices (total of 4), I receive the errors described above. If I do one client for each HTTPService, the specific host (which is HTTP/2 enabled) receives a lot more Can this be some kind of race condition inside the connection pool cause by the HTTP/2 implementation? |
@victoraugustolls Are we off to close this now that we tracked a reproducible issue in #841? |
I still receive timeouts with http2 disabled, but I think we can close this now and come back to it later, what do you think? |
It'd be interesting to test |
I would gladly deploy a version of the microservice that I see this behaviour with a version which uses |
@florimondmanca one point is that here I raised many types of errors and described receiving On #841 the errors are |
This is a very interesting point. Should we perhaps look deeper into what we might be doing differently than Requests when establishing a connection in the sync case? Our sync implementation is currently backed by urllib3 so if you’re experiencing timeouts in the sync case then there must be something Requests does that we don’t — most likely a special edge case for certain kinds of hosts. |
I can try making the endpoint sync again but using the sync client instead of the requests library to see what’s happens. As soon as I do this I can post the result here! |
@florimondmanca @tomchristie by using |
With |
Right, and presuambly then only because we have tighter defaults. |
If you are referencing to timeout defaults, I'm using this Session and Client:
|
Also, I receive the following errors with
|
Hi @victoraugustolls, is this still an issue as of 0.13? Curious if any of the improvements since 4mo ago have helped reduce these spurious connect timeouts. |
Hi @florimondmanca , sorry for the (very) late response. I just deployed a version of my api with the newest release and I must say it works flawlessly. The only error I receive is this one: If you want, I can give more info about this error. |
@victoraugustolls That'd be great yup - is there an easy minimal way to reproduce it? |
Hi!
I'm quite confused about
Connect Timeout
. I observed that I have some applications that happens to throw aConnectionTimeout
exception inhttpx/backends/asyncio.py
, in this part (lines 201, 202):What I think is strange is that, my applications are monitored with NewRelic and Microsoft Application Insights, and although they say that a request took something like 5s, I can find the request in the origin and it took just some milliseconds.
So I think my question here is this: is there something in the origin application that can cause this timeout? Maybe some blocking code? Or wrong
AsyncClient
creation?Any help would be appreciated, thanks!
Obs: my applications are developed using FastAPI
The text was updated successfully, but these errors were encountered: