aiohttp ClientSession requests memory leak? #5993
Unanswered
grantsloman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I believe I have unearthed a memory leak in my long-lived application when using aiohttp ClientSession requests. If each coroutine which makes a request is awaited sequentially, then all seems fine. However there seems to be a leak of request context manager objects when run concurrently.
Please consider the following example code:
Some
tracemalloc
code is then used to periodically log memory allocations. This shows the count for allocations inaiohttp/client.py
whererequest()
returns a_RequestContextManager
increasing over time, initially quickly but then slows until reaching a peak and then seems to be fairly stable.However, It has then been observed that if there is a network problem and requests start to fail then the count ramps back up again - and doesn't come back down after the problem has been resolved.
Is this a leak? If so, is there a way to work around it? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions