-
-
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
BaseConnector limit and limit_per_host don't work with tracing enabled #5259
Comments
Good catch! |
Thanks @asvetlov - I agree on the unit test - I'll submit a PR without a test for now and if someone has a way to test it I'll be glad to add it in. |
Thanks! |
Welcome! |
🐞 Describe the bug
The BaseConnector limit and limit_per_host attributes don't function properly when tracing is enabled and the connection is being reused. BaseConnector.connect() calls _available_connections(), and when it gets back a number > 0, it will await any configured traces before acquiring the connection. That is enough time for another thread to jump in and acquire the same connection, allowing more than the configured number of connections to exist simultaneously. connect() needs to acquire the connection, possibly with a placeholder, before awaiting the traces.
💡 To Reproduce
💡 Expected behavior
There should not be more than the configured limit number of connections active at any given time
📋 Logs/tracebacks
📋 Your version of the Python
📋 Your version of the aiohttp/yarl/multidict distributions
📋 Additional context
client
The text was updated successfully, but these errors were encountered: