-
-
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
Memory leak with aiohttp.request #1756
Comments
should be fixed, will release new version today |
2.0.4 is released |
Thanks for jumping on this. Running my example code I still see the memory climb as the requests are made and then not drop down after the garbage collecting. So I suspect there are more memories issues. |
does it grows all the time? gc does not show any leaked objects. |
As the loop of 500 requests is done the memory for the python process grows, then while the sleep is happing it's static. |
Are connections closed after each request? Look at netstat |
@alex-eri I checked out netstat and it looks like there are not any connection left around. |
I was looking into this. After messing around with objgraph I found an abnormal growth in memory (33 MiB to 500 MiB in a timespan of 12 hours). I originally thought it was my code but some inspection led me to this library instead. Looking at the growth of object references over time I found the following: dict 27731 +22390
deque 9730 +8927
method 9802 +8926
ServerDisconnectedError 4848 +4465
weakref 6668 +4464
SSLProtocol 4850 +4464
_SSLProtocolTransport 4850 +4464
ResponseHandler 4849 +4464
_SSLPipe 4850 +4464
SSLObject 4850 +4464 Which was odd given that I don't store references to any of those cases. I began by investigating the ServerDisconnectError reference chain since I found it odd to store references to those, but that just led me back to It ends at some list. I checked out the list and it's just a list of I should note that I do not use Apologies if this is not helpful. |
I guess asyncio's ssl transport implementation just bad. Could you try uvloop? |
@fafhrd91 More investigation points this to |
Do you see this with 2.0.4? |
2.0.4 is what I'm using. |
ok, I will check |
I'm using uvloop but also seem to be experiencing a memory leak. My application has been running for 30 hours making roughly 10 requests per second and my memory usage is ~450MB when it would normally be ~150MB. |
@fafhrd91 Some more investigation that I did out of curiosity. It seems to me that you intended Checking its Making sure that the Hope these findings help you. |
I found problem. working on fix |
@fafhrd91 I have tested it and it does seem to fix the issue. |
ok, good |
Long story short
I'm working on a long running program that makes a significant number of https requests, and the memory of the program increases steadily.
Expected behaviour
I would expect the memory to remain relatively constant.
Actual behaviour
For a sample 500 requests the memory increases approximate 8 meg doing just requests.
Steps to reproduce
Your environment
aiohttp 2.0.2 inside a
python:3.6.0-slim
docker container.The text was updated successfully, but these errors were encountered: