-
-
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
ClientSession benchmark only works with aiohttp.TCPConnector(force_close=True) #3609
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #2224 (aiohttp.TCPConnector()), #2867 (aiohttp.ClientSession reconnect ), #975 (aiohttp.ClientSession raises ServerDisconnectedError), #1812 (Working with aiohttp.ClientSession from a command line), and #3371 (wrong cookies when i use aiohttp.ClientSession(cookies=cookies)). |
I have similar problem with my script below. python 3.7.0 and aiohttp-3.5.4
|
we just hit the same bug using aiohttp 3.7.4.
|
It looks like |
This may be caused by (badly implemented) servers which close a connection immediately after sending a response with a keep-alive header. In this case, aiohttp (rightly) assumes the connection will remain open and releases it to the connection pool. It then gets picked up for another request before the server close event comes through, resulting in an error when the new request is made. To work around this, we now have retry logic for safe/idempotent methods (e.g. GET), so these common errors shouldn't occur anymore. Can you retest with 3.10? |
Long story short
Simple benchmark test fails on the defaults but works with
connector=aiohttp.TCPConnector(force_close=True)
.Steps to reproduce
docker run -p 80:80 httpd
python3 test.py
async with aiohttp.ClientSession() as client:
to
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(force_close=True)) as client:
python3 test.py
Script runs to completion in several seconds.
It's expected that the default setup (with keep-alive enabled) is at least as stable as with
force_close=True
for this benchmark.Your environment
Windows 10 and Debian Gnu/Linux, Python 3.7, aiohttp 3.5.2.
The text was updated successfully, but these errors were encountered: