-
Notifications
You must be signed in to change notification settings - Fork 402
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
Connection pool aenter get connection from queue and not return connection to user. #955
Comments
aiohttp = "^3.8.1" The problem manifests itself Randomly with a large number of requests. Exception: Type Error Exception: |
elprans
added a commit
that referenced
this issue
Oct 9, 2023
`wait_for` has been a mess with respect to cancellations consistently in `asyncio`. Hopefully the approach taken in Python 3.12 solves the issues, so adopt that instead of trying to "fix" `wait_for` with wrappers on older Pythons. Use `async_timeout` as a polyfill on pre-3.11 Python. Closes: #1056 Closes: #1052 Fixes: #955
elprans
added a commit
that referenced
this issue
Oct 9, 2023
`wait_for` has been a mess with respect to cancellations consistently in `asyncio`. Hopefully the approach taken in Python 3.12 solves the issues, so adopt that instead of trying to "fix" `wait_for` with wrappers on older Pythons. Use `async_timeout` as a polyfill on pre-3.11 Python. Closes: #1056 Closes: #1052 Fixes: #955
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the issue with a local PostgreSQL install?: no, local installation
uvloop?: didn't try, problem with reproducing, we use uvloop
We use connection pool. And connections are ending after while and our app is hang up (all new response has status code 500 and error "can not get connection from pool"). We observe this behavior when postgres process several queries simultaneous long time and we try to get new connection from the pool with timeout. This is not not stable and can happen 1 per week.
We debug and see following strangeness:
Our code
asyncpg code (we added log)
We calculate "connection was received" messages count (let be A ) and "connection was gotten from queue" messages count (let be B ) after after app hanged up.
B - A = connection pool size
.We have hypothesis that problem here . Future is completed but occurred timeout before
compat.wait_for
return result.We try to use following code
[async-timeout](https://github.com/aio-libs/async-timeout)
does not create additional task fromctx.__aenter__()
coroutine. This code work for us (but maybe we're lucky).The text was updated successfully, but these errors were encountered: