-
-
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
KeepAlive Timeout: what is it? #1093
Comments
Same here but everything's going well anyway. ¯\(ツ)/¯ |
They are perfectly normal (in most cases). In HTTP/1.1 connections are keep-alive by default which means your browser keeps the connection open after it made all the requests. After some time if you don't request a new page this connection will timeout. Not sure why Sanic devs log such thing in INFO mode. IMHO this would be a DEBUG level since most users don't even understand what's going on. |
Also, I kept on getting these, which also didn’t use to happen:
What am I being warned about exactly? The site runs fine and I don’t quite understand what I am supposed to fix. |
As @frnkvieira said, this are perfectly normal messages, you can take a look into the docs for more information. I would suggest to keep it on, if the client requesting will request several "resources" (i.e. frontend client) but if you're only dealing with a single API call from time to time then you can switch it off (if you want to ignore it it's ok but you can switch it off while developing). hope it helps :) (if so then please don't forget to close the issue) |
I'm also thinking this could be DEBUG level |
@smlbiobot this is a notification that you have some code that runs longer than expected by Sanic. |
ah ok thanks very much — that is helpful. If I encounter many of those, am I supposed to add in some |
@smlbiobot Theres some confusion and misunderstanding in this thread that I'd like to clear up. Some background:
The Request Timeout variable was default to 60 seconds. This was correct behaviour for scenario 1, but not for 2 or 3. The biggest problem was that every time a client connected using the KeepAlive function, we would see an unexplainable RequestTimeout Exception thrown by the server 60 seconds later, logged to the console, and 403 response sent to the client, as reported in Issue #902. In response to that, in PR #939 I wrote some code to split the Request Timeout into three different timeouts. Each with their own configurable timeout length in seconds. Read about them in the docs as pointed out by @arnulfojr and @zjuchenyuan here: The biggest change #939 introduced is that we are no longer treating KeepAliveTimeout as an error. It is a normal thing to happen. Every KeepAlive-enabled connection is expected to timeout at some point after it is created. So rather than throwing an exception (as per previous behaviour), it now simply logs it using the normal server-level logging output. So rather than seeing logs polluted with RequestTimeout exceptions as per #902, we are now seeing logs polluted with KeepAlive Timeout notifications, as per OP's issue here.
This is not correct. You are thinking of a ResponseTimeout exception. @frnkvieira @arnulfojr @yunstanford After seeing this Issue thread, and the confusion that it is causing some users, I think perhaps it is better to move it to DEBUG level, but I want the opinion of others on that matter too. |
This is a python It is indication that an asynchronous task was executed on the event loop and later returned a value after being awaited for a period of time. I'm not sure why it is logged at WARNING level. |
Thanks for your detailed response — it is rather unexpected but very helpful indeed. I have in fact encountered those same mysterious errors you have referenced in #902 and am very happy to know that they are in fact not errors. It took me a while to debug what is going on — but since I could not find anything wrong with my app, I just moved on and ignored them. Your explanation makes a lot of sense and I am happy that this is normal. As per the asyncio warning, you are right, it appears that I have some rather complex logic stuck in those code blocks that require extra processing. I have taken the approach read on the web and inserted All in all — thanks for your help and it is very much appreciated. I shall close this issue now since you have more than answered my questions. |
If it makes a difference, I'd like the KeepAlive Timeout messages to be switched to debug level. |
Dame it |
Since upgrading from 0.5.0 to 0.7.0 I am seeing a lot of these in my logs:
What are these and are they normal or is there something in my code that I need to fix?
The text was updated successfully, but these errors were encountered: