-
-
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 created in aiohttp.request() remains unclosed #2036
Comments
I already have a fix for this issue but as version 2.2.0 is not added to the v2 release branch, I can not submit a pull request to it that could pass all the checks then. I created a branch from the version tag 2.2.0 and commited there: https://github.com/das7pad/aiohttp/tree/close-created-session |
I recommend switch from |
But this change literally deprecates In python version 3.5 one could simply use |
we can silence warning for |
Good to me. Honestly I want to remove |
simplicity. |
aiohttp is OSS project. Well, I could buy your argument for keeping |
What could be cleaner than |
Ok, let's just suppress a warning |
@fafhrd91 is that a note to this line? https://gist.github.com/das7pad/4ff20e6a8e7e3242bffb9ee9c30809d3#file-aiohttp_fetch_comparison-py-L29 |
@das7pad I am talking about using session as async context manager. you example is fine. |
The functionality was changed and fixed in aiohttp 3.0 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
Using
aiohttp.request()
to file http requests spamms the logfiles.The
aiohttp.ClientSession
created inaiohttp.request()
should be closed gracefully, but currently the session reference is just deleted.Expected behaviour
No resource warning from using
aiohttp.request
Actual behaviour
Unclosed
aiohttp.ClientSession
s messages for every requestsee tdryer/hangups#340
Steps to reproduce
call
aiohttp.request
https://github.com/tdryer/hangups/blob/master/hangups/http_utils.py#L33-L36
From another project you can find a tester with results on different aiohttp version here:
https://gist.github.com/das7pad/e8f63175377576a0cb3466d20a417fa5
Your environment
python v3.5.3
aiohttp v2.2.0
The text was updated successfully, but these errors were encountered: