-
-
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
Unclosed connection #1799
Comments
Creating the connector in yet another context manager seems to fix the issue (Noctem/aiopogo@aefd128), but it doesn't seem like that should be necessary. Shouldn't a connector that is created in the kwargs of a context-managed edit: I'm actually getting a few even with the extra context manager, though it seems less frequent. |
I can not reproduce this. it might be related to proxy. |
I experience the issue without using a proxy. I'll try to throw together a complete script for triggering it tonight. |
I could never setup a proxy for my bot to use even. If I could then I would use it so it does not use the same IP address I use (as some servers ban by account and IP address which would also mean RIP my non bot account). |
Not sure if it was something that changed on my end or yours but the problem isn't happening any more so I'll close this. |
aiohttp/client.pyline_no: 328try:
resp = req.send(conn)
try:
await resp.start(conn, read_until_eof)
except BaseException:
resp.close()
conn.close()
raise
except ClientError:
raise
except OSError as exc:
raise ClientOSError(*exc.args) from exc Here is the uncatched exception which is raised by req.send(conn):
and then the Unclosed connection warning occurred. traceback by add except Exception as e:
print(e, type(e), id(conn)) to the bottom of the former code snippet |
I think there's definitely a race problem of some sort; doing a GET followed too quickly by a POST gives various errors, typically Inserting a short [Running on Ubuntu 16.04, i7 1.6GHz. Python 3.6.6, with Django server running on the same machine.] |
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
My event loop exception handler gets
Unclosed connection
messages from one part of my code that's using async context managers forClientSession
.Expected behaviour
The context manager would create the session and properly close the session and connector without any errors.
Actual behaviour
My loop's exception handler receives:
Steps to reproduce
This is where it happens in my code. I'm using sessions elsewhere without issue, the main difference here is that I'm using an async context manager to close it as soon as the requests are finished, whereas elsewhere I'm reusing sessions for the duration of execution.
Or simplified:
It seems that error occurs when a
Connection
's_protocol
isn'tNone
at the time of deletion, but why isn't the context manager preventing that?Your environment
macOS 10.12.4, Python 3.6.1, uvloop 0.8.0, aiohttp 2.0.6
The text was updated successfully, but these errors were encountered: