Comments (6)
Hello, I can confirm we've hit the same issue in Rally (Elasticsearch benchmarking tool). elastic/rally#1804
from aiohttp.
This might be a side effect of using the callback done running with a call soon
from aiohttp.
I see similar issues in our application. The following code exposes a problem on my machine (Python 3.11):
import asyncio
import random
from typing import Any
import aiohttp
async def main() -> None:
# Usually works when this is `<= 100`
num_calls = 120
client = aiohttp.ClientSession()
async def call(n: int) -> Any:
# This service echoes the request body in the response
# The random timeout is key here, it works when `timeout=None`
response = await client.put(
"http://localhost:3000/", timeout=random.random(), json={"n": n}
)
body = await response.text()
return (n, body)
results = await asyncio.gather(
*[call(i) for i in range(num_calls)], return_exceptions=True
)
for result in results:
if isinstance(result, Exception):
print(type(result))
else:
print(result)
await client.close()
asyncio.run(main())
On version 3.8.6 this does what you would expect with the n in the request and in the response matching:
(95, '{"n":95}')
<class 'TimeoutError'>
<class 'TimeoutError'>
<class 'TimeoutError'>
(99, '{"n":99}')
(100, '{"n":100}')
<class 'TimeoutError'>
(102, '{"n":102}')
<class 'TimeoutError'>
(104, '{"n":104}')
(105, '{"n":105}')
<class 'TimeoutError'>
(107, '{"n":107}')
<class 'TimeoutError'>
<class 'TimeoutError'>
(110, '{"n":110}')
<class 'TimeoutError'>
<class 'TimeoutError'>
(113, '{"n":113}')
(114, '{"n":114}')
(115, '{"n":115}')
(116, '{"n":116}')
(117, '{"n":117}')
<class 'TimeoutError'>
<class 'TimeoutError'>
However, on 3.9.0, we see this:
(Seemingly recycling responses after 100 when at least one timed out)
(98, '{"n":98}')
<class 'TimeoutError'>
<class 'TimeoutError'>
<class 'TimeoutError'>
<class 'TimeoutError'>
(103, '{"n":60}')
(104, '{"n":58}')
(105, '{"n":71}')
<class 'TimeoutError'>
<class 'TimeoutError'>
(108, '{"n":77}')
(109, '{"n":100}')
<class 'TimeoutError'>
<class 'TimeoutError'>
<class 'TimeoutError'>
(113, '{"n":26}')
<class 'TimeoutError'>
(115, '{"n":2}')
<class 'TimeoutError'>
(117, '{"n":25}')
(118, '{"n":31}')
<class 'TimeoutError'>
We also saw other unexplainable behaviour that could be caused by this, but I have no evidence nor re-production of that.
from aiohttp.
Does anyone have a working test case we can merge as an xfail test so we can validate a fix?
from aiohttp.
bisected this to #7764
from aiohttp.
bisected this to #7764
Yeah, I already assumed it would be related to that. Something to do with us previously closing the connection and now we're trying to reuse it.
from aiohttp.
Related Issues (20)
- test_client_session_timeout_zero requires internet connection
- Replace aiodns with dnspython HOT 1
- pathlib.Path-alike no longer works in 3.9.0 for web.FileResponse HOT 4
- StreamReader.iter_chunked(n) yields chunk_sizes < n before end of stream HOT 5
- Handling static URLs
- using server_host name param for ws_connect
- Possibility to specify headers encoding HOT 1
- Appkey is not defined in the handlers. HOT 9
- `test_import_time` failed on RISC-V HOT 2
- Receiving different response when using aiohttp instead of requests module? HOT 3
- Teardown/cleanup logic is sometimes not called. HOT 5
- Under mac os, ClientSession fails to request the stream interface. HOT 4
- aiohttp.web fails to parse cookies after a cookie with quotes HOT 7
- add aiohttp.MozillaCookieJar to load/save cookies.txt files
- Issue with the OutputString method in controlling value assignment HOT 1
- FileResponse + enable_compression + .gz will compress twice HOT 12
- `FileResponse` has undefined behavior if the file is changed out from under it between the `stat` and `open` calls
- ClientSession timeout AttributeError
- Removal of 'loop' Parameter in web.run_app HOT 8
- Cannot build wheels for aiohttp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiohttp.