-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
sanic.exceptions.RequestTimeout: Request Timeout #902
Comments
Are you, by chance, reproducing this using postman? One reason your connection would keep dropping is if the client wouldn't respect the |
Thanks for your replay. I use Request Header:
Response Header:
Should I drop |
I have the same problem in our project. We are using Sanic with Socket.io server implementation. |
@MaxOvcharov Yes, we have the same problem. @jackfischer Maybe the |
@MaxOvcharov could you elaborate your own issue? @jiaxiaolei does not have an actual issue aside from unnecessary exception being raised. I've tried the provided snippet and I'm getting the correct response, along with 200 status code. @r0fls you might want to close this issue and the duplicate. Handling |
Yes, after I do |
@MaxOvcharov I did @jrocketfingers you tried the snippet and fount no |
I've been seeing this error behaviour with every Sanic app I've written in the last month or two. I see it when I use Postman to test my routes, but also when I use Firefox and Chromium. By reading through the Sanic sourcecode and tracing requests and responses step-by-step, I have determined why this is happening, and it is caused by the fact when using the KeepAlive feature, sanic's default KeepAliveTimeout value is equal to the RequestTimeout value (which is 60 seconds by default). So the browser upholds its side of the deal by keeping the connection open for 60 seconds after receiving the response. Even though Sanic updates the And I believe this is normal and expected behaviour. This is the intended result of the KeepAlive feature expiring correctly and it is being triggered exactly when it should be. The problem is it is reported and logged as an |
In my post above, I was testing on v0.6.0. UPDATE:
However, that raises some questions:
|
I'm nearly done writing up some new code to track these timeouts. Some things I've noticed:
Can someone clarify if it was a deliberate design decision to lump RequestTimeout, ResponseTimeout, and KeepAliveTimeout events all into one catch-all callback/exception? Perhaps for performance reasons? I've currently got some proof-of-concept code that splits these out into three separate timeout handlers with their own timeout callbacks, each with different logic, different logging properties, and different default values, as per what is set out in the HTTP 1.1 specs. Im currently writing some tests to verify the new functionality, and as part of doing that, I've had to subclass two new Sanic Test Clients, one which can inject a delay between when the TCPConnection is opened and when the request is sent (to test RequestTimeout) and another one which can Reuse an existing open TCP connection (to test KeepAliveTimeout). |
Ha, I use Sanic and get a same problem today. @app.exception(exceptions.RequestTimeout)
async def Timeout(request, exception):
return response.json({"status":"RequestTimeout"}) |
Hi folks, just wanted to say I'm still seeing this with 0.7.0. Just started using Sanic the last few days and it's great, but I usually get these RequestTimeout exceptions about a minute after the last request. I do see the KeepAlive timeout prior to that as well. I don't always see the RequestTimeout exceptions though, there's some randomness to it. |
Experiencing the same issue as mentioned by @garyo in 0.7.0 |
@ashleysommer Sure, i'll do an RCA and raise an issue. Thanks. |
I glanced at the issues(61), and did not found the problem I encounter.
I find the problem more than one time. There is a example to show the problem.
In the module
method_sanic.py
, there is just one url. After I run the server bypython method_sanic.py
, I get the response through typehttp://[ip]:8001/get
.But, few seconds later, the backend throw an exception,
sanic.exceptions.RequestTimeout: Request Timeout
.I try it few times, the problem is not occur every time.
Now, the problem is a bug in
sanic
? I use it in a wrong way?Any response is gratitude.
The text was updated successfully, but these errors were encountered: