-
Notifications
You must be signed in to change notification settings - Fork 419
Leaked connections caused by timeout on pool.acquire #467
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
Comments
I don't know is it the same problem or not but my server time to time start freeze because all connection was stuck. I have some exceptions time to time from PG but it's not a timeout. |
1st1
pushed a commit
that referenced
this issue
Nov 19, 2019
Should be fixed in master. Thanks for reporting! |
aaliddell
added a commit
to aaliddell/asyncpg
that referenced
this issue
Mar 28, 2020
Closes MagicStack#547 When wait_for is cancelled, there is a chance that the waited task has already been completed, leaving the connection looking like it is in use. This fix ensures that the connection is returned to the pool in this situation. For context, see: https://bugs.python.org/issue37658 MagicStack#467
elprans
added a commit
that referenced
this issue
Aug 16, 2020
`asyncio.wait_for()` currently has a bug where it raises a `CancelledError` even when the wrapped awaitable has completed. The upstream fix is in python/cpython#37658. This adds a workaround until the aforementioned PR is merged, backported and released. Fixes: #467 Fixes: #547 Related: #468 Supersedes: #548
elprans
added a commit
that referenced
this issue
Aug 16, 2020
`asyncio.wait_for()` currently has a bug where it raises a `CancelledError` even when the wrapped awaitable has completed. The upstream fix is in python/cpython#21894. This adds a workaround until the aforementioned PR is merged, backported and released. Fixes: #467 Fixes: #547 Related: #468 Supersedes: #548
elprans
added a commit
that referenced
this issue
Aug 16, 2020
`asyncio.wait_for()` currently has a bug where it raises a `CancelledError` even when the wrapped awaitable has completed. The upstream fix is in python/cpython#21894. This adds a workaround until the aforementioned PR is merged, backported and released. Co-authored-by: Adam Liddell <[email protected]> Fixes: #467 Fixes: #547 Related: #468 Supersedes: #548
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?:
uvloop?:
Timeout on pool.acquire can be cause of leaked connections. The reason is that asyncio.wait_for cancels inner task on timeout here and it is the same problem as described in #464. But in this case using of asyncio.shield outside asyncpg cannot fix the problem.
The code below reproduces the problem (timeout which reproduces the problem depends on connection time):
Traceback of error:
Even after pool is closed some connections are not closed while python process is running.
The text was updated successfully, but these errors were encountered: