Message388253
I have stumbled in this bug, or something similar, implementing psycopg3 async connection pool. A function such as the following fails but only in Python 3.6 (tested 3.6.12):
async def wait(self, timeout: float) -> AsyncConnection:
"""Wait for a connection to be set and return it.
Raise an exception if the wait times out or if fail() is called.
"""
async with self._cond:
if not (self.conn or self.error):
try:
await asyncio.wait_for(self._cond.wait(), timeout)
except asyncio.TimeoutError:
# HERE
self.error = PoolTimeout(
f"couldn't get a connection after {timeout} sec"
)
In python 3.6, printing self._cond.locked() in the HERE position gives False, even if it's inside the with block. Everything grinds to a halt afterwards.
However I don't have the same problem in other Python versions (3.7.10, 3.8.5 among the ones tested) so I'm not sure it is the same issue.
Is this a manifestation of the same bug or a different one? Is there any workaround or should I make the async pool just not supported on Python 3.6? |
|
Date |
User |
Action |
Args |
2021-03-07 23:37:37 | piro | set | recipients:
+ piro, asvetlov, lukasz.langa, hynek, yselivanov, uriyyo |
2021-03-07 23:37:37 | piro | set | messageid: <1615160257.73.0.214968353147.issue42600@roundup.psfhosted.org> |
2021-03-07 23:37:37 | piro | link | issue42600 messages |
2021-03-07 23:37:37 | piro | create | |
|