-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Lots of CancelledError when requests are interupted #1565
Comments
here is code that handle cancelation https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/server.py#L292 could you confirm same behavior with default event loop? |
I can confirm it's happening with the standard event loop:
I got this on a different project as running the benchmark tests is a bit involved but it's the same problem. Seems to always relate to |
i see the problem |
Looking at it, the second case is slightly different as the connection is being acquired in middleware. Is that significant? |
it is related to web_server.Server implementation, it was introduced in 1.2.0 version. it just swallows exceptions |
should be fixed in master |
This is indeed fixed in master. Thanks a lot, it would be great if there was a new release so I could use it on FrameworkBenchmarks currently every time a test is run aiohttp is printing about 10k lines of errors. |
I will make new release early next week. I need to add timeouts to client close |
@fafhrd91 Will it not conflict with #1586? because that would also be something to merge before the release as well as it fixes an issue with the warnings about initializing client session outside of an coroutine with an event loop. Because the original one was bugged because some things was flipped around. |
Even with aiohttp 1.3.2 I am facing the same issue , if a request gets cancelled I get tonnes of errors in my error log saying |
This sounds like a different issue. aiohttp is correctly dealing with You'll need to do something like (in your view handler) try:
obj = await get_the_data()
except CancelledError:
raise # aiohttp will cope with error
else:
return json_response(obj) |
@samuelcolvin Even after adding the above handler it still gives me a bunch of Added this to my handler :
|
Yeah can confirm this has still not been fixed. |
I'm pretty sure the issue I originally submitted the issue about has been fixed. But that doesn't mean you can't still have issues in your application code with However, I could be wrong. Please provide a simple example I can run which demonstrates the issue, eg. via a gist. |
@niteeshm what version do you use? Did you try master? |
@fafhrd91 @samuelcolvin I tried this on 1.3.3. I am using |
As i said before you can still get cancellederror from upstream connections, eg. Database. This is not aiohttp at fault. Please provide an example yo demonstrate the problem. |
@niteeshm please provide an example, will reopen then |
Long story short
aiohttp barfs out hundreds of
concurrent.futures._base.CancelledError
when requests are interrupted.Expected behaviour
Not sure, I guess we can't just ignore
CancelledError
in requests but it would be good if there was some way to stop loads of errors being printed.This is annoying in the terminal but could cause a major backlog if sentry etc. were connected and processing exceptions.
You can catch and ignore this error with middleware:
But I'm not sure how safe this is?
Actual behaviour
Coming through thousands of times as I run
wrk
load tests. I suspect the same would occur with ajax interrupted requests or even browsers stopping a request if a new one is requested.Steps to reproduce
While running your aiohttp application with gunicorn.
Your environment
Ubuntu.
The text was updated successfully, but these errors were encountered: